1
當我將視圖控制器推送到屏幕一半的導航控制器時,由於某種原因,以前的視圖控制器標題飛出了界限。這隻發生在iOS 5,而不是iOS 6.任何想法,爲什麼這可能會發生或我們如何解決它?UINavigationBar標題飛出界限
當我將視圖控制器推送到屏幕一半的導航控制器時,由於某種原因,以前的視圖控制器標題飛出了界限。這隻發生在iOS 5,而不是iOS 6.任何想法,爲什麼這可能會發生或我們如何解決它?UINavigationBar標題飛出界限
你可以設置導航欄標題像這樣: -
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
UIBarButtonItem *addButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)] autorelease];
self.navigationItem.rightBarButtonItem = addButton;
UILabel *label = [[UILabel alloc]initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)];
[label setBackgroundColor:[UIColor clearColor]];
[label setNumberOfLines:0];
[label setTextColor:[UIColor whiteColor]];
[label setTextAlignment:UITextAlignmentCenter];
[label setFont:[UIFont systemFontOfSize:12]];
NSString *str [email protected]"1234567890 1234567890 1234567890 1234567890 1234567890 123456";
[label setText:str];
self.navigationItem.titleView = label;
}