【发布时间】:2013-11-21 07:16:20
【问题描述】:
从 tableview 控制器,我显示一个模态视图来捕获视频剪辑... 取消后(无剪辑拍摄),图像选择器被关闭,表格视图重新显示但黑屏......似乎不再被填充......我错过了什么?
// MySwingsViewController.h
#import <UIKit/UIKit.h>
#import "Swing.h"
#import "SwingCell.h"
#import <MediaPlayer/MediaPlayer.h>
#import <MobileCoreServices/MobileCoreServices.h>
@interface MySwingsViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource, UIImagePickerControllerDelegate, UINavigationControllerDelegate >
@property (nonatomic, strong) NSMutableArray *swings;
@property (copy, nonatomic) NSURL *movieURL;
@property (strong, nonatomic) MPMoviePlayerController *movieController;
@property (strong, nonatomic) IBOutlet UIBarButtonItem *captureSwingbutton;
- (IBAction)captureSwing:(id)sender;
@end
和 MySwingsViewController.m
// MySwingsViewController.m
#import "MySwingsViewController.h"
@interface MySwingsViewController ()
@end
@implementation MySwingsViewController
{
NSArray *tableData; //just for test purposes
}
- (void)viewDidLoad
{
NSLog(@"view did load");
[super viewDidLoad];
// Initialize table data
tableData = [NSArray arrayWithObjects:@"Egg Benedict", @"Mushroom Risotto", @"Full Breakfast", @"Hamburger", @"Ham and Egg Sandwich", @"Creme Brelee", @"White Chocolate Donut", @"Starbucks Coffee", @"Vegetable Curry", @"Instant Noodle with Egg", @"Noodle with BBQ Pork", @"Japanese Noodle with Pork", @"Green Tea", @"Thai Shrimp Cake", @"Angry Birds Cake", @"Ham and Cheese Panini", nil];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"SwingCell";
SwingCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (cell == nil) {
cell = [[SwingCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
cell.titleLabel.text = [tableData objectAtIndex:indexPath.row];
return cell;
}
- (IBAction)captureSwing:(id)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = NO;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
... // capture new clip
}
...
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
NSLog(@"picker did cancel");
[picker dismissViewControllerAnimated:YES completion:NULL];
[self.navigationController popViewControllerAnimated:YES];
}
cancel 被记录,picker 被关闭,返回 tableview,但数据没有重新显示...
【问题讨论】:
标签: ios uitableview