我在Interface Builder中设置View Controller nib的默认View Outlet时遇到问题.这是我的设置:
我有一个基于TabBar的应用程序,我将导航控制器加载为模态视图...
MyNavCtrlrSubClass *menu = [[MyNavCtrlrSubClass alloc]initWithNibName:@"MenuController" bundle:nil];
[tabBarController presentModalViewController:menu animated:anim];
Run Code Online (Sandbox Code Playgroud)
MenuController本身的结构如下:
MenuController.xib
File's Owner (MyNavCtrlrSubClass : UIViewController)
Navigation Controller (UINavigationController)
Navigation Bar (UINavigationBar)
Root View Controller (Nib Name is set to load AnotherViewController.nib)
Navigation Item -> (UINavigationItem)
这一切都很好,除了加载MyNavCtrlrSubClass时,我得到以下错误:
Loaded the "MenuController" nib but the view outlet was not set
很清楚为什么会发生这种情况 - 文件所有者的视图没有插座连接.问题是我应该将其视为什么,并且首先必须设置一些东西?导航栏是MenuController.xib中唯一的候选者,但这样做只会将UINavigationBar本身调整为全屏模式,可以这么说.
我显然在IB中遗漏了什么,但是什么?MyNavCtrlrSubClass.m本身没有代码,除了UINavigationController的IBOutlet.我试图在IB中完全设置这个错误吗?我们的想法是将模态导航控制器保存在一个笔尖中,并将所有视图加载到单独的笔尖中,但由于MenuController只是导航的容器并且本身不包含任何视图,因此我显然设计错误.:)
如果你想知道我为什么不以其他方式设计它,那是因为我试图服从我(可能是错误的)感知IB如何要求你建立一个理想的等级.
任何帮助将不胜感激.
iphone interface-builder uiviewcontroller uiview uinavigationcontroller
在我的ViewDidLoad中,我尝试了类似的东西,但它不起作用:
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10,2,60,14)];
label.autoresizingMask = UIViewAutoresisingFlecibleWidth;
[self.navigationController.navigationBar addSubview:label];
Run Code Online (Sandbox Code Playgroud)
我想在NavigationBar的左侧部分显示一个标签.或者可能更改navigationBar.title位置
谢谢,
我只在我的应用程序中使用Three20作为一个画廊.
当我.. : TTThumbsViewController从另一个视图中推送我时,导航栏不是我想要的颜色(根据我的应用程序的其余部分).我已TTDefaultStyleSheet根据此stackoverflow QA设置了一个.因为我只使用TTThumbsViewController,我有什么特别的事吗?
拇指视图也是在顶部创建了额外的空间,就好像它为导航控制器留出了空间,而不知道那里已经存在.我如何告诉TTThumbsViewController使用现有的uinavigationcontroller?或者表现得好像?
MYThumbsViewController *mYThumbsViewController = [MYThumbsViewController alloc];
[self.navigationController pushViewController:mYThumbsViewController animated:YES];
Run Code Online (Sandbox Code Playgroud)
问题描述的图形:
替代文字http://www.imgplace.com/img594/1309/39testapp.png
谢谢!
我正在使用以下语句推送我的视图控制器:
[[self navigationController] pushViewController:self.customViewController animatedWithTransition:UIViewAnimationTransitionFlipFromLeft];
Run Code Online (Sandbox Code Playgroud)
现在当我按下后退按钮时,我想用uiviewanimationtransitionflipfromright来设置动画.
喜欢
[self.navigationController popViewControllerAnimatedWithTransition:UIViewAnimationTransitionFlipFromLeft];
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?
谢谢
我有点问题了.我正在尝试向我的应用添加一个popoverview,但部分popoverview被我的导航控制器栏隐藏起来.如何将我的popoverview覆盖在navcontrollerbar的顶部?这是问题的图像:http://img593.imageshack.us/img593/4056/viewn.jpg
这是我正在使用的代码:
- (IBAction)onButtonClick:(UIButton *)button {
if (self.popoverController) {
[self.popoverController dismissPopoverAnimated:YES];
self.popoverController = nil;
[button setTitle:@"Show Popover" forState:UIControlStateNormal];
} else {
UIViewController *contentViewController = [[WEPopoverContentViewController alloc] initWithStyle:UITableViewStylePlain];
self.popoverController = [[[WEPopoverController alloc] initWithContentViewController:contentViewController] autorelease];
[self.popoverController presentPopoverFromRect:button.frame
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];
[contentViewController release];
[button setTitle:@"Hide Popover" forState:UIControlStateNormal];
}
}
Run Code Online (Sandbox Code Playgroud)
反正有没有在导航控制器栏上面制作这个弹出窗口?
希望有人知道如何解决这个问题,提前谢谢.
我正在开发一个iPhone应用程序,我开始使用基于导航的模板.但是现在我想在底部添加一个Tap Bar控制器,我想在不使用Interface Builder的情况下执行此操作.谁能告诉我怎么做?提前致谢!
我正在学习UINavigationController和UIViewControllers.这是我构建的简单应用程序.请注意,我使用ARC.
我的应用程序有一个导航控制器和两个视图控制器(让我们称他们为FirstViewController和SecondViewController).当应用程序启动时,导航控制器推送FirstViewController堆栈.
在FirstViewController我有一个按钮,触摸时推动SecondViewController.这是一些代码.
FirstViewController.m
-(IBAction)pushSecondViewController
{
SecondViewController *secondViewController = [SecondViewController alloc]init];
[self.navigationController pushViewController:secondViewController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
在第二个视图控制器中,我有一个按钮,从堆栈中弹出当前视图控制器.
SecondViewController.m
-(IBAction)popViewController
{
[self.navigationController popViewControllerAnimated:YES];
}
Run Code Online (Sandbox Code Playgroud)
到现在为止还挺好.这是我的问题:
navigationController是否检查现有实例,SecondNavigationController如果不存在则会创建一个新实例?
如果没有,我应该使用单例来确保每次SeconViewController触摸按下的按钮时只创建并重用一个实例而不是创建新实例吗?
我已经设置了一个navController,它在点击按钮后出现.但是,如果我点击按钮,我会收到以下错误:" Warning: Attempt to present <UINavigationController>: 0xab5d9d0 on <MyApp: 0xadaa320> whose view is not in the window hierarchy!"
有谁知道如何解决这个问题?我也尝试过Stackoverflow,但这不是我的解决方案.
这里是我打开navigationcontroller的代码:
我不知道是否有人知道这个照相馆,但如果你不知道,这是项目.
我的代码(MyApp.m):
#import MyApp.h
...
//some stuff
- (void)launchGalleryView
{
MWPhotoBrowser *browser = [[MWPhotoBrowser alloc] initWithDelegate:self];
// Set browser options.
browser.wantsFullScreenLayout = YES;
browser.displayActionButton = NO;
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:browser];
NSMutableArray *photos = [[NSMutableArray alloc] init];
MWPhoto *photo;
photo = [MWPhoto photoWithFilePath:[[NSBundle mainBundle] pathForResource:@"callculator" ofType:@"jpg"]];
photo.caption = @"The calculator is soo beateful...";
[photos addObject:photo];
self.photos …Run Code Online (Sandbox Code Playgroud) 嗯,技巧问题,我知道这是可能的,因为有一些应用程序在做,特别是Reeder做得很好.
在Reeder中,看起来弹出的视图控制器不会从内存中移除,或者不管是什么典型行为,因为在弹出并返回到前一个视图控制器之后,您可以从右向左滑动以稍微查看,如果您在离开之前滚动前一个视图控制器,您仍然可以看到滚动发生.这种快速跳回到您正在查看的先前视图控制器的能力,而不必从头开始预加载正是我正在寻找的.
基本上,在iOS 7中默认情况下,当您从视图控制器的左边缘向右滑动时,它会将其弹出导航堆栈.我喜欢能够从右边缘向左滑动以将其添加回来.可以想象,在Web浏览器中,您可以在按下后单击"前进"按钮.(或者在iOS 7的Safari中你怎么能做到这一点.)
这个功能是默认情况下iOS 7的一部分,我只是找不到它?或者有关于如何完成它的任何信息?
我正在为iOS开发一个社交媒体应用程序
我ViewControllers目前已经嵌入了NavigationController.在我的新闻提要屏幕上,我需要在用户向下滑动时显示搜索栏(并在他向上滑动时隐藏它),其中如果用户输入内容,搜索结果将显示在新闻提要屏幕的顶部.
我试图修补这个,但我对iOS很新,到目前为止还没有设法让它工作.
任何帮助将grately理解和记住,我只几个星期的编程的iOS这样一些深层次的将是有益的.谢谢 !
iphone ×7
objective-c ×5
ios ×3
animation ×1
cocoa-touch ×1
ios7 ×1
storyboard ×1
swift ×1
three20 ×1
uikit ×1
uisearchbar ×1
uiview ×1