我目前有一个视图设置如下:
@interface BlogViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
UITableView *mainTableView;
}
@property (nonatomic, retain) UITableView *mainTableView;
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,它内部有一个UITableView,我将所有数据加载到.但是,当我调用以下函数时:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
SingleBlogViewController *viewController = [[SingleBlogViewController alloc] init];
[self.navigationController pushViewController:viewController animated:YES];
//[self presentModalViewController:viewController animated:YES];
[viewController release];
}
Run Code Online (Sandbox Code Playgroud)
什么都没发生.出于某种原因,我的UITableView内心UIViewController并没有推动观点.这是因为它不是UITableViewController吗?我尝试将其更改为,但仍然无法正常工作.
我在这里错过了什么吗?
uitableview uinavigationcontroller pushviewcontroller ios4 ios
我正在尝试简单的操作.至少看起来很简单.好吧,我想做的是从一个用模态视图控制器推动的视图中推送视图(使用推视图控制器).
View1 - (使用模态视图控制器推送) - > View2 - (使用推视图控制器推送) - View3.
Rigth现在,我正在做测试,所以我正在使用一个按钮来启动动作.这是我用来从View2推送到视图3的代码:
//view2.h
UIToolbar *bar;
UIBarButtonItem *button;
UIToolbar *toolbar;
}
- (IBAction)demissModal:(id)sender;
- (IBAction)goView3:(id)sender;
@end
//view2.m
- (IBAction)goView3:(id)sender{
View3 *view_3 = [[View3 alloc] initWithNibName:@"View3" bundle:nil];
[self.navigationController pushViewController:view_3 animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
这是我用来将View1推送到View2的相同代码,它可以工作.但是当将View2推送到View3时,它无法正常工作.知道为什么会这样吗?谢谢!
我有一个使用故事板的标签栏控制器应用程序.每个选项卡都有一个UIWebview.我想在用户单击Webview上的链接时捕获链接,如果链接是外部链接(如果它不是我的站点)我想在不同的UIViewControl中打开链接.(就像一个popupi Twitter iphone应用程序那样做)
马上; 我有这个代码捕获链接(如果链接是bing.com然后它应该打开它另一个视图控制器)但我无法打开另一个UIViewController(在这种情况下PopViewController).它给了我这个错误:
'GundemViewController'没有可见的@interface声明选择器'pushViewController:animated:'
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
//CAPTURE USER LINK-CLICK.
NSURL *url = [request URL];
NSString *urlString = [url absoluteString];
/******
UIWebViewNavigationTypeLinkClicked: When user click on a link in the app it senses the action
*/
if (navigationType == UIWebViewNavigationTypeLinkClicked) {
if ([urlString hasPrefix:@"http://www.bing.com/"]) {
PopViewController *popUpView = [[PopViewController alloc] initWithNibName:@"PopupViewController" bundle:nil];
[self pushViewController:popUpView animated:YES];
return NO;
}
}
return YES;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用透明模式推送视图控制器。
这是我的代码:
SearchViewController * searchViewController= [self.storyboard instantiateViewControllerWithIdentifier:@"SearchViewController"];
searchViewController.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.7f];
[self.navigationController pushViewController:searchViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)
我做错的事情找出来并帮助我解决这个问题。
alpha-transparency uinavigationcontroller pushviewcontroller ios
我用以下代码检测键盘何时显示.但是,当我使用pushViewController推送到另一个屏幕并在该屏幕中打开键盘时,将调用keyboardWillShow!这真的是对的吗?
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
// register for keyboard notifications
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillHide:)
name:UIKeyboardWillHideNotification
object:nil];
Run Code Online (Sandbox Code Playgroud) cocoa-touch uikeyboard pushviewcontroller nsnotificationcenter ios
使用动画NO以编程方式在UINavigationController上执行多个弹出和推送操作时出现问题.(仅限iOS7 iPhone)
源代码 https://github.com/abhishek9284/NavigationBarTest
要了解问题,请考虑以下视图树.
(我在我的应用程序中使用UITableViewController)
右键单击并在新选项卡中选择打开图像以查看大图像.

错误信息
右键单击并在新选项卡中选择打开图像以查看大图像.

执行以下导航时出现错误/问题.
在上面的步骤2和3中,以编程方式使用动画NO进行弹出和推送,这使得UINavigationBar后退按钮和标题非常奇怪.
注意:上述问题仅在iOS 7中出现,并且在iOS 6中完美运行.
uinavigationbar uinavigationcontroller popviewcontroller pushviewcontroller ios
我想在收到推送通知后导航到某个视图控制器.导航后,导航堆栈应该像用户手动进入视图一样工作.
故事板:http://www.xpos.nl/xpos/images/common/storyboard.png
在AppDelegate.swift中我已经有:
func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
println("didReceiveRemoteNotification")
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let destinationViewController = storyboard.instantiateViewControllerWithIdentifier("MessageViewController") as MessageViewController
let navigationController = self.window?.destinationViewController;
navigationController?.pushViewController(destinationViewController, animated: false, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
但是我得到一个错误,即destinationViewController不是窗口的一部分,或者如果我更正(在stackoverflow上尝试其他答案),没有任何反应.
我有两个UIViewControllers.我的第一个UIViewController显示各种视频缩略图,照片和笔记.并且第二个控制器可用于在先前的控制器中显示所选的视频,照片或音符.我在我的第一个控制器中也有一个UICollectionView,它列出了iOS中Apple的Photo App.
我使用"pushviewcontroller"来显示我的第二个视图控制器.
UIStoryboard *sb=[UIStoryboard storyboardWithName:@"Storyboard" bundle:nil];
FirstDetailViewController *fD=[sb instantiateViewControllerWithIdentifier:@"firstDetail"];
[self.navigationController pushViewController: seconVCObj animated: YES];
Run Code Online (Sandbox Code Playgroud)
但我想用ios照片应用程序等缩放效果打开它.当您触摸照片时,应用会将照片显示为缩放.
首先,我根本不想使用故事板.我能够"呈现"目标视图控制器,但我无法通过顶部的标准iOS后退按钮显示它.我的理解是我可以通过推动控制器而不是呈现它来实现这一点.我没有任何错误,但没有任何反应.
在按钮上单击此代码即可运行.注释代码成功呈现了ForgotPasswordPage:
//更改忘记密码页面
func forgotPasswordSwitch(sender: UIButton!) {
//let ForgotPassword:ForgotPasswordPage = ForgotPasswordPage()
//self.presentViewController(ForgotPassword, animated: true, completion: nil)
let ForgotPassword = ForgotPasswordPage()
self.navigationController?.pushViewController(ForgotPassword, animated: true)
}
Run Code Online (Sandbox Code Playgroud) uiviewcontroller uinavigationcontroller pushviewcontroller ios swift
我有一个带有标识符的Show类型。它从UIViewController导航到UiStoryboardSegueabSegueAB。在整个应用程序中,我使用了自定义的UINavigationController,它工作得很好,但是在这里却不是。
使用self.performSegue(id: "abSegue", sender: self)会导致丢失UINavigationController,但使用
let controller = UIStoryboard(name: "Storyboard", bundle: bundle).instantiateViewController(withIdentifier: "B")
navigationController?.pushViewController(controller)
Run Code Online (Sandbox Code Playgroud)
工作正常,我收到了预期UINavigationController。
什么会导致这种行为?
uinavigationcontroller pushviewcontroller uistoryboard uistoryboardsegue swift