相关疑难解决方法(0)

presentModalViewController无法正常工作

这是我的代码:

ViewController *vc = [[ViewController alloc] initWithNibName:@"TableView" bundle:nil];
[self.navigationController presentModalViewController:vc animated:YES];
//[self setView:[vc view]];
Run Code Online (Sandbox Code Playgroud)

如果我打电话给它,没有任何反应.但是,如果我将其更改为:

ViewController *vc = [[ViewController alloc] initWithNibName:@"TableView" bundle:nil];
//[self.navigationController presentModalViewController:vc animated:YES];
[self setView:[vc view]];
Run Code Online (Sandbox Code Playgroud)

视图看起来很好(当然没有过渡).我究竟做错了什么?初始化视图控制器时是否有任何特殊需要处理?我试图从Apple的例子中尽可能多地复制,但我无法让它工作......

感谢您的任何意见!

- Ry

iphone uiviewcontroller

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

如何从Today Widget打开特定的View Controller?

我正在创建一个简单的今日小部件,其中包含一个按钮,此按钮应该 - 按下时 - 在我相应的应用程序中打开一个特定的视图控制器.

我想到的唯一解决方案是创建一个只能打开初始视图控制器的URL类型(至少据我所知).

下面是我目前在UIButton操作中使用的代码:

   var url = NSURL(string: "_my_url_://")
    extensionContext?.openURL(url!, completionHandler: nil)
Run Code Online (Sandbox Code Playgroud)

ios swift ios8-today-widget

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

标签 统计

ios ×1

ios8-today-widget ×1

iphone ×1

swift ×1

uiviewcontroller ×1