标签: presentmodalviewcontroller

如何调用presentViewController?

下面是这样的情况:我有一个类MainView(它是一个UIViewController)并从中调用一个UIActionSheetDelegate类.我想使用presentViewController方法,但以下代码不起作用(当前在ActionSheet类中调用):

[self presentViewController:myViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)

关于从(MainView或ActionSheetDelegate)调用方法的地方我有点困惑.

提前致谢.

uiviewcontroller uiactionsheet presentmodalviewcontroller ios

1
推荐指数
1
解决办法
2万
查看次数

如何将MFMessageComposeViewController解除为mainView Controller?

假设我有两个控制器A和B以及一个MFMessageComposeViewController.我正在执行这些操作

A-> presentModalViewController - > B.

B-> presentModalViewController - > MFMessageComposeViewController对象

所以在消息撰写didFinishWithResult委托我要回到A控制器而不是B.

我已经尝试了几个步骤,如委托中的2次dismissModalViewControllerAnimated,并直接从委托调用A控制器,但没有任何工作.每次它只解散一次,它仍然在B控制器上.

取消/发送我想回到A控制器.

iphone uiviewcontroller uinavigationcontroller dismiss presentmodalviewcontroller

1
推荐指数
1
解决办法
1671
查看次数

UINavigation:如何从呈现的模态视图中推送视图

我在导航视图时遇到问题.

我有VC说,登录,我从另一个VC调用,如:

- (IBAction) btnAction 
{           Login * login = [[Login alloc] init];

        [self.navigationController pushViewController:login animated:YES];
}   
Run Code Online (Sandbox Code Playgroud)

在登录VC中有两个按钮,例如Register和Forget Password,它们相应地调用另一个VC,RegisterVC和ForgetPassVC.

- (IBAction) btnRegisterNow : (id) sender
{

    aRegister = [[Register alloc] initWithNibName:@"Register" bundle:nil];
    [self.navigationController pushViewController:aRegister animated:YES];  
}

- (IBAction) btnForgotPassword : (id) sender
{
    forgotPassword = [[ForgotPasswd alloc] initWithNibName:@"ForgotPasswd" bundle:nil];
    [self.navigationController pushViewController:forgotPassword animated:YES];
}
Run Code Online (Sandbox Code Playgroud)

我的问题 :

当我打电话给登录时,[self.navigationController pushViewController:login animated:YES];每件事都很好.

但是在某些VC中我需要显示登录页面.[self presentModalViewController:login animated:YES];此时注册和忘记密码这两个按钮不起作用.按钮点击没有任何反应.

问题是什么 ?我认为bocz我已经添加了Login作为模态视图而不是pushViewConterller ??? 如果是的话那么我该如何完成这项任务呢?

希望问题很清楚.

谢谢...

iphone objective-c uinavigationcontroller presentmodalviewcontroller

1
推荐指数
1
解决办法
719
查看次数

我可以在iPhone上使用setModalPresentationStyle吗?

我一直在关注iTunes上的一些iPhone开发视频,特别是"Standford Fall 2011 iPad和iPhone App Development",在讲座15中,Modal View Controller/test/Animation表示setModalPresentationStyle只能用于iPad.我想用iPhone应用程序这样做,这可能吗?有没有更新,因为这是允许它?还是有另一种方法可以模拟这个功能?像表单表示样式.

iphone xcode objective-c presentmodalviewcontroller ios

1
推荐指数
1
解决办法
4907
查看次数

iPhone使用segues从UITextField呈现模态视图?

正如标题所述,我正在使用iOS5功能故事板.我有一个文本字段,在点击时应显示模态视图(带选择器).我想知道可以使用segues触发这个动作吗?

当您有按钮或单元格时,只需按住Ctrl键即可查看要显示的控制器.我已经对文本字段做了同样的事情但没有可见的结果.我只是按它而且只有键盘弹出.没有模态视图显示.我该怎么办?

iphone uitextfield presentmodalviewcontroller uistoryboardsegue

1
推荐指数
1
解决办法
2932
查看次数

ios6中的方向问题

我在我的应用程序中使用UINavigationController,我的第一个控制器叫做A,它只对portrite有严格要求,我的A控制器中有一个按钮.一旦我点击按钮,我就会在另一个名为B的视图控制器上创建实例.在为BI创建实例后,使用以下方法进行模态呈现

[self presentViewController:BInstance animated:YES completion:^{
            NSLog(@"completed");
        }];
Run Code Online (Sandbox Code Playgroud)

我的B控制器能够支持所有方向,这是预期的,直到ios5.1及更早版本.现在我正在尝试使用Xcode4.5在ios6上运行我的项目它没有被轮换我期待解决这个问题我发现了一些关于shouldAutorotateToInterfaceOrientation 的博客:方法从最新的ios6中被弃用了.我也用过替代品

-(BOOL)shouldAutorotate{
    return YES;
}
-(NSUInteger)supportedInterfaceOrientations{
    return UIInterfaceOrientationMaskAll;
}
Run Code Online (Sandbox Code Playgroud)

但仍然没有太多预期的结果.

问题:什么使我的B控制器适用于所有方向,即使我的父A只适用于portrite.

在此先感谢您对此有用的所有建议/建议.

uinavigationcontroller ipad presentmodalviewcontroller ios6

1
推荐指数
1
解决办法
1250
查看次数

如何将UINavigationController添加到呈现为Modal的UIViewController

我的应用程序中有另一种流程.这个流程从我的firstViewController开始,然后在这个视图中调用我的secondViewController,如下所示:

- (IBAction)PressButton:(id)sender {

    SecondViewController *second = [[SecondViewController alloc] init];
    second.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
    UINavigationController *nav = self.navigationController;
    [nav presentViewController:second animated:YES completion:nil];                              
}
Run Code Online (Sandbox Code Playgroud)

在我的secondViewController中,我想推送我的第三个ViewController.但它不起作用我试过这种方式:

- (IBAction)pressButton:(id)sender {

   ThirdViewController *tvc = [[ThirdViewController alloc] init];
   UINavigationController *nav = self.navigationController;
   [nav pushViewController:tvc animated:YES];
Run Code Online (Sandbox Code Playgroud)

}

当我按下secondViewController的按钮时没有任何反应.

我做错了什么?

我正在使用:

  • OSX 10.8.2
  • Xcode 4.6
  • iOS 6.1

iphone xcode uinavigationcontroller presentmodalviewcontroller ios6

1
推荐指数
1
解决办法
7839
查看次数

iOS(Swift) - UIViewControllers数组

我有一个UIButton具有唯一tag值的数组.当按下给定按钮时,我想加载并呈现一个UIViewController也存储在等长的数组中.

UIViewController要呈现的s是子类的子类UIViewController:

class AViewController: UIViewController {}
class BViewController: AViewController {}
class CViewController: AViewController {}
class DViewController: AViewController {}
// ... etc.
Run Code Online (Sandbox Code Playgroud)

我已经尝试AViewController使用以下内容存储子类数组:

private var array: [AViewController] = [BViewController.self, CViewController.self, DViewController.self]
Run Code Online (Sandbox Code Playgroud)

但我得到错误无法将类型'[BViewController] .Type'的值转换为第一个元素的指定类型'[AViewController]'.

然后,我将BViewController使用以下内容(例如):

let ViewController = array[button.tag].self
var viewController: AViewController
viewController = ViewController.init()
viewController.transitioningDelegate = self
viewController.modalPresentationStyle = .custom
present(viewController, animated: true)
Run Code Online (Sandbox Code Playgroud)

请告诉我,如果这是一个不正确的思考过程,请做这样的事情,并感谢您的帮助.

arrays uiviewcontroller presentmodalviewcontroller ios swift

1
推荐指数
1
解决办法
707
查看次数

有没有办法将数据从一个视图传递给modalviewcontroller

我有一个UIView和一个按钮的视图.按下按钮会弹出一个ModalViewController,它是带有UITextField的UIView.我需要将UIView中的NSObject的字符串值作为字符串传递给ModalViewController.点击按钮我称之为:

-(void) editNote{

TextViewController * vc = [(TextViewController *)[TextViewController alloc] init];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:vc];

[self.navigationController presentModalViewController:nav animated:YES];
[vc release];
}   
Run Code Online (Sandbox Code Playgroud)

通常,在行选择时我们使用pushviewcontroller将数据推送到下一个视图,但是在做了很多谷歌后我无法弄清楚如何使用presentmodalviewcontroller传递数据.

iphone objective-c uiview presentmodalviewcontroller

0
推荐指数
1
解决办法
245
查看次数

关闭多个ModalViewControllers iOS

好的,我知道有很多关于这个主题的信息,但是我尝试的一切都不起作用.我的设置是这样的.

应用程序使用navigationController加载View A,这是一个Tableview.延迟后,我提出了一个ModalView B.在视图B上我有一个按钮,在视图B上方显示另一个模态视图C.在模态视图中CI有一个按钮来消除C.现在当我按下这个按钮时我也想要消解模态查看B将我带回我的RootView,这是提到的tableView视图A.

从模态视图CI有一个按钮,但只能使用下面的动作来解除C这需要我进入模态视图B:我想要做的是用这个按钮删除C和B,如果可能的话,将我返回给A?

-(IBAction)dismissWebView:(id)sender{

[self dismissModalViewControllerAnimated:YES];

}
Run Code Online (Sandbox Code Playgroud)

我已经从上面的行动中尝试了所有这些

[self.parentViewController dismissModalViewControllerAnimated:YES];
[self.parentViewController.parentViewController dismissModalViewControllerAnimated:YES];
[adsRootView dismissModalViewControllerAnimated:YES];
[self dismissModalViewControllerAnimated:YES];
[self dismissModalViewControllerAnimated:YES];
[self.navigationController dismissModalViewControllerAnimated:YES];
[self.adsRootView dismissModalViewControllerAnimated:YES];
[[[self parentViewController] parentViewController] dismissModalViewControllerAnimated:YES];
[self.navigationController popToRootViewControllerAnimated:NO];
Run Code Online (Sandbox Code Playgroud)

除了仅解除Modal视图C之外,其中任何一个都没有做任何事情.

uiviewcontroller uinavigationcontroller modalviewcontroller presentmodalviewcontroller ios

0
推荐指数
1
解决办法
1387
查看次数

IOS在AppDelegate中访问模态视图

我正在尝试访问AppDelegate.m中的视图.我self.window.rootViewController用来获取对活动ViewController的引用,但是当我创建模态视图时,presentViewController我无法访问新呈现的视图.如何从AppDelegate.m获取对模态视图的引用?

iphone presentmodalviewcontroller ios appdelegate

0
推荐指数
1
解决办法
1311
查看次数

具有透明背景的 Swift 模态视图控制器超出选项卡栏

我在要点中尝试了相同的代码:https : //gist.github.com/barbietunnie/e5547f35180436ac102cac52a15f8ca3

func showModal() {
    let modalViewController = ModalViewController()
    modalViewController.modalPresentationStyle = .OverCurrentContext
    presentViewController(modalViewController, animated: true, completion: nil)
}

class ModalViewController: UIViewController {
    override func viewDidLoad() {
        view.backgroundColor = UIColor.clearColor()
        view.opaque = false
    }
}
Run Code Online (Sandbox Code Playgroud)

它工作正常,但在标签栏的情况下,内容超出了标签栏,我们如何使内容在标签栏的上方/前面可见?

presentmodalviewcontroller ios swift

0
推荐指数
1
解决办法
1588
查看次数