我打电话的时候:
ChooseDateView *nextController = [[ChooseDateView alloc] initWithNibName:@"ChooseDateView" bundle:nil];
[self.navigationController pushViewController:nextController animated:YES];
Run Code Online (Sandbox Code Playgroud)
是否有必要调用[nextController release]?
谢谢
我的情况如下:
1)我有带有navigationController的rootViewController并在工具栏中添加按钮.当我按下我使用pushViewController方法推送另一个视图.这个视图叫做chooseTypeView,它只有两个单元格的tableview.
2)当点击任何单元格时,将使用相同的方法推送第三个视图以输入一些数据.
3)现在我想按下键盘上的"完成"按钮导航回rootView控制器并关闭当前步骤和根视图之间的所有视图.
我正在使用@Protocol连接视图,我可以将信息从最后一个视图传递到根视图,但我无法忽略它.
谢谢大家,我希望我能说清楚.
我想要做的是类似于Foursquare的iPhone应用程序中导航项下面的"探索"选项卡.
http://reviews.cnet.com/i/tim/2011/03/10/foursquare-iphone.png
谢谢!
目前,我对所有不同视图的标题都正确呈现:
self.title = self.viewedCategory.title;
Run Code Online (Sandbox Code Playgroud)
但是,由于数据结构,主根视图没有标题.我试着用这个解决它:
if (self.viewedCategory.title == Nil) {
self.title = @"Root View Title";
} else {
self.title = self.viewedCategory.title;
}
Run Code Online (Sandbox Code Playgroud)
但这不起作用,我不知道为什么.我也尝试'== @""'认为它可能是一个没有任何字符的字符串,但这也不起作用.
思考?
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]))
{
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel
target:self
action:@selector(cancel)];
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Send to Twitter"
style:UIBarButtonItemStyleDone
target:self
action:@selector(save)];
}
return self;
}
Run Code Online (Sandbox Code Playgroud)
另一段代码
- (void)loadView
{
[super loadView];
self.navigationController.navigationBar.tintColor = [UIColor blackColor];
self.view.backgroundColor = [UIColor whiteColor];
self.textView = [[UITextView alloc] initWithFrame:self.view.bounds];
textView.delegate = self;
textView.font = [UIFont systemFontOfSize:15];
textView.contentInset = UIEdgeInsetsMake(5,5,0,0);
textView.backgroundColor = [UIColor whiteColor];
textView.autoresizesSubviews = YES;
textView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view …Run Code Online (Sandbox Code Playgroud) 我在我的项目中使用TTLauncherView.要拥有自定义导航栏背景,我已在我的应用委托中将UINavigationBar子类化.这很好用,所有导航栏现在都有这种自定义样式.
@implementation UINavigationBar (CustomNavBarBG)
-(void)drawRect:(CGRect)rect{
UIImage *image = [UIImage imageNamed:@"navbar_s.png"];
[image drawInRect:self.bounds];
}
@end
Run Code Online (Sandbox Code Playgroud)
浏览视图时,标题会显示在栏的中间.但是在主屏幕的导航栏上,启动器,我想要一个图像而不是标题.这可能吗?
怎么实现呢?
我在基于导航的应用程序中有大约25个视图.从第25个视图我想回到主屏幕.如何从导航堆栈中删除所有视图?我是否必须检查每个视图是否为零并从堆栈中删除?
请帮忙.提前致谢.
我在导航堆栈上弹出一些视图控制器后出现此错误,最后我通过操作表询问问题.我得到的错误参数不满意view != nil,这让我发疯,因为它nil在我调用动作表之前检查时不是一个值.
if (self.view != nil) {
NSLog(@"view is not nil");
}
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:@"title" delegate:nil cancelButtonTitle:@"cancel" destructiveButtonTitle:@"destructive" otherButtonTitles:nil];
[actionSheet showInView:self.view];
Run Code Online (Sandbox Code Playgroud) cocoa-touch uiviewcontroller uiview uinavigationcontroller uiactionsheet
我写了下面这段代码:
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
GameViewController *gameViewController = [[GameViewController alloc]initWithLevelNumber:([levelGroup intValue]*100+indexPath.row) Bonus:NO];
NSLog(@"Retain Counter =%d",gameViewController.retainCount);
[navController pushViewController:gameViewController animated:YES];
[gameViewController release];
NSLog(@"Retain Counter=%d",gameViewController.retainCount);
[tableView deselectRowAtIndexPath:indexPath animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
两个日志的结果按顺序1和6!这怎么可能?我只调用一次alloc方法并在将控制器推到堆栈后释放.. alloc-> + 1,push-> + 1,release-> -1 = 1或不?
当我将它从堆栈中弹出时,我希望视图控制器是dealloc'd ..
objective-c uinavigationcontroller pushviewcontroller ios retaincount
我是iPhone开发的新手,想问一下导航控制器.如何使导航控制器固定在整个应用程序上,如facebook导航栏.它始终在导航栏中显示通知,朋友和消息.
我试图将自定义视图放在titleView中,但每次导航推送新视图时它都会消失?
iphone ×5
objective-c ×4
ios ×3
cocoa-touch ×2
uiview ×2
facebook ×1
retaincount ×1
three20 ×1
xcode ×1
xcode4.2 ×1