简体   繁体   English

如何在 iphone 编程中导航视图?

[英]How to navigate the view in iphone programming?

In my appController's ViewDidLoad, I have done some thing as below在我的 appController 的 ViewDidLoad 中,我做了如下一些事情

  - (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];
}
}

I have two methods as below,我有以下两种方法,

- (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];
}
}

Now as I click the button, the method will launch the class showing custom view, I want to call this without clicking the button, what should I do?现在当我单击按钮时,该方法将启动 class 显示自定义视图,我想在不单击按钮的情况下调用它,我该怎么办?

I wrote the button coding directly in ViewDidLoad, but not working at all我直接在 ViewDidLoad 中编写了按钮编码,但根本不起作用

This code, I took from apple's documentation as example这段代码,我以苹果的文档为例

Help !帮助 !

If I understand correctly, you are wanting to show a view?如果我理解正确,你想展示一个视图?

If so you could push using:如果是这样,您可以使用:

[self.navigationcontroller pushviewcontroller:YOURVIEWCONTROLLER animated:YES];

Or you could present it using:或者您可以使用以下方式呈现它:

[self presentModalViewControllerpushviewcontroller:YOURVIEWCONTROLLER animated:YES];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM