从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];
}
取消记录,选择器被解除,返回到tableview,但数据不会重新显示...
答案 0 :(得分:0)
不要调用[self.navigationController popViewControllerAnimated:YES];这段代码实际上解雇了当前的MySwingsViewController,我相信你的表视图是在MySwingsViewController上吗?