0
在我AppController中的viewDidLoad,我做了一些事情,如下如何瀏覽iphone編程中的視圖?
- (void)viewDidLoad
{
self.overlayViewController =
[[[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil] autorelease];
// as a delegate we will be notified when pictures are taken and when to dismiss the image picker
self.overlayViewController.delegate = self;
self.capturedImages = [NSMutableArray array];
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
// camera is not on this device, don't show the camera button
NSMutableArray *toolbarItems = [NSMutableArray arrayWithCapacity:self.myToolbar.items.count];
[toolbarItems addObjectsFromArray:self.myToolbar.items];
[toolbarItems removeObjectAtIndex:2];
[self.myToolbar setItems:toolbarItems animated:NO];
}
}
我有如下兩種方法,
- (IBAction)cameraAction:(id)sender
{
[self showImagePicker:UIImagePickerControllerSourceTypeCamera];
}
- (void)showImagePicker:(UIImagePickerControllerSourceType)sourceType
{
if (self.imageView.isAnimating)
self.imageView.stopAnimating;
if (self.capturedImages.count > 0)
[self.capturedImages removeAllObjects];
if ([UIImagePickerController isSourceTypeAvailable:sourceType])
{
[self.overlayViewController setupImagePicker:sourceType];
[self presentModalViewController:self.overlayViewController.imagePickerController animated:YES];
}
}
現在,當我按一下按鈕,該方法將推出類顯示自定義查看,我想在不點擊按鈕的情況下調用它,我該怎麼辦?
我寫的按鈕直接在viewDidLoad中編碼,但在所有
此代碼不能正常工作,我從蘋果公司的文件帶爲例
幫助!
我這樣做是在viewDidLoad中,但不能導航,我已經試過這兩者。 –
附加到事件(例如按鈕事件)時它可以工作嗎? – JohnHodkinson
您是否也可以確保視圖「OverlayViewController」也拼寫正確的文件名。 – JohnHodkinson