如何在导航栏上设置对backButtonItem的操作?我有一个导航栏,当我按下后退按钮时,我需要向用户发出一些消息,并且只有在用户的反应之后 - 返回上一个视图.我该怎么做?感谢名单!
- (void)viewDidLoad
{
[super viewDidLoad];
//no one field don't changed yet
isDirty = FALSE;
//edited user
//set default values
newData = [data copy];
//setting navigation controller rigth button
UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Save"
style:UIBarButtonSystemItemDone
target: self
action: @selector(saveBtnUserClick)];
self.navigationItem.rightBarButtonItem = rightButton;
[rightButton release];
UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonSystemItemDone
target: self
action: @selector(backBtnUserClick)];
self.navigationItem.backBarButtonItem = leftButton;
[leftButton release];
}
Run Code Online (Sandbox Code Playgroud)
//和我的反应方法
-(IBAction) backBtnUserClick
{
NSLog(@"\n Back pressed");
//back to previous view
[self.navigationController popViewControllerAnimated: TRUE];
}
Run Code Online (Sandbox Code Playgroud) 如何在UITabBarController中的"more"中为"Configure"修改UINavigationBarTintColor?
我在UITabBarController中有10个UINavigationController(一切都使用Interface builder.)
我可以使用Interface builder轻松设置所有UINavigationController的UINavigationBar的色调颜色.
同样地,我还发现我们可以修改More的色调颜色如下.
tBarDashboard.moreNavigationController.navigationBar.tintColor=
[UIColor colorWithRed:30/255.0 green:103/255.0 blue:7/255.0 alpha:1.0];
// here tbarDashboard is my UITabBarController.
Run Code Online (Sandbox Code Playgroud)
但是如果tabbarcontroller中有太多的导航控制器,TabBarController默认允许配置导航控制器的排列.
我的问题是"如何修改配置屏幕的色调?".
iphone xcode uinavigationbar uitabbarcontroller uinavigationcontroller
在我们的应用程序中,当其中一个视图被推送到导航控制器时,导航栏可见5秒钟,然后我们将navigationBarHidden设置为TRUE.稍后,如果用户点击屏幕,我们切换navigationBarHidden值.但是,当导航栏ID隐藏或可见时,视图会分别为这些操作上下跳动.
当隐藏或显示栏时,有什么方法可以防止视图跳跃?
谢谢和问候,Hetal
我正在尝试将一个UIViewController (AddProjectViewController)添加到一个导航控制器(navigationController),它有一个tableView设置为root,但它不起作用.
这就是我设置文件的方式:http://d.pr/y8rt
代码在ProjectsController.m- 请帮助:(
我有一个带UINavigationController的UITabbarController.NavigationController中的视图呈现MVC(AddClockNavigationController).这个MVC有一个带有视图的nib和一个UINavigationController.NavigationController.view作为子视图添加到MVC的视图中.
我的MVC中的NavigationController有两个按钮,一个取消和一个完成.当按下其中任何一个时,MVC应该被解雇.这些按钮的IBActions位于UINavigationController的视图(AddClockViewController)中,但每当按下它们时,MVC就不会消失.如果我把动作放到MVC中,它就会消失.如果我把函数放在我的MVC中并使用[self.parentViewController myFunction]从我的viewController调用它,它就不会消失.
我怎么能让它从我的视线中消失?
我想我的言论非常混乱,但我希望你理解它.
我IB的观点:

最诚挚的问候,
Paul Peelen
编辑
我有试过这个[self dismissModalViewControllerAnimated:YES];,[self.parentViewController dismissModalViewControllerAnimated:YES];,[self.navigationController dismissModalViewControllerAnimated:YES];,[self.parentViewController.navigationController dismissModalViewControllerAnimated:YES];和,如前所述,随着parentView贬的功能.什么都行不通.
我有一个视图,将新视图推送到屏幕上.
显示新视图时,导航控制器中没有后退按钮.
我在一个视图中有以下内容
然后使用以下代码推送新视图
[photoViewController setAsset:[assets objectAtIndex:(cell.rowNumber * 4) + index]];
[[self navigationController] pushViewController:photoViewController animated:YES];
[photoViewController release];
Run Code Online (Sandbox Code Playgroud)
当视图出现时,可以看到以下内容

如何添加后退按钮以及在第二个视图中将相同的共享按钮添加到栏的位置?
谢谢.:)
我正在使用推送通知。单击通知中的操作按钮时,我试图在NavigationController中创建并推送DetailView。但navigationController为零。如何将那个DetailView放在navigationController中?我想在navigationController中然后在DetailView中推送RootViewController。我怎样才能做到这一点?
在AppDelegate中:
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
RootViewController *controller = [[RootViewController alloc] init];
//getting warnings here.(Unused variable navigationController)
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:controller];
[controller doStuff];
[controller release];
}
Run Code Online (Sandbox Code Playgroud)
在RootViewController中:
-(void)doStuff{
[[self stories] removeAllObjects];
[self startParsing];
[self.tableView reloadData];
DetailViewController *detail = [[DetailViewController alloc] init];
//custom code
[self.navigationController pushViewController:detail animated:YES];
[detail release];
Run Code Online (Sandbox Code Playgroud)
这是即时消息正在使用的代码。和请注意,我有
[self.tableView reloadData];
Run Code Online (Sandbox Code Playgroud) iphone cocoa-touch objective-c uinavigationcontroller apple-push-notifications
我正在创建一个导航基础应用程序.我也需要显示一个标签栏.
我的mainWindow.xib包含:
UINavigationController,UITabBarController.UITabBarController有三个UINavigationController.
在基于条件的算法上,我正在显示导航和TabBar.
它运作良好.当我想移动TabBar的任何内部视图时会出现问题:它在那里显示了navigationBar(我需要的东西),但它也显示了TabBar.我想删除所有内部视图的TabBar.当我隐藏tabbar时,它仍占据视图底部的空间.我试图重置视图和窗口的框架,但没有任何帮助.
如何在我的视图中隐藏tabBar并使用其空间?
我使用的逻辑是否正确?如果没有,请告诉我们如何纠正它.如果有教程那就更好了.
如何在保持标题的同时为UINavigationController使用背景图像?来自其他线程的ck的答案确实可以放置图像并保留文本.但是如果用户导航到其他视图(使用[navigationController pushViewController]),则只有背景出现在新屏幕中.
如何更改UINavigationController的背景图像,同时在多个视图中保持标题?
iphone cocoa-touch objective-c uiviewcontroller uinavigationcontroller
我现在在推送另一个视图控制器之前启动活动指示器,但它没有开始为活动指示器设置动画.
[activityindicator startanimating];
[self.navigationcontroller pushviewcontroller:viewcontroller animated:YES];
[activityindicator stopanimating];
Run Code Online (Sandbox Code Playgroud) iphone ×9
cocoa-touch ×2
ios ×2
objective-c ×2
back-button ×1
ipad ×1
tableview ×1
uiview ×1
xcode ×1