1
我已經想出瞭如何隱藏導航欄,然後顯示它內置的工具欄,但工具欄出現在屏幕的底部os如何將工具欄放置在scren的頂部?如何將UIToolbar放置在屏幕的頂部?
這裏是我的一些代碼
UIBarButtonItem *yesterday = [[UIBarButtonItem alloc]initWithTitle:@"Yesterday"
style:UIBarButtonItemStyleBordered target:self action:@selector(yesterday:)];
UIBarButtonItem *today = [[UIBarButtonItem alloc]initWithTitle:@"Today"
style:UIBarButtonItemStyleDone target:self action:@selector(today:)];
UIBarButtonItem *tomorrow = [[UIBarButtonItem alloc]initWithTitle:@"Tomorrow"
style:UIBarButtonItemStyleBordered target:self action:@selector(tomorrow:)];
UIBarButtonItem *month = [[UIBarButtonItem alloc]initWithTitle:@"Month"
style:UIBarButtonItemStyleBordered target:self action:@selector(month:)];
NSArray *items = [NSArray arrayWithObjects:yesterday,today,tomorrow,month, nil];
[yesterday release];
[today release];
[tomorrow release];
[month release];
[self setToolbarItems:items];
[[self navigationController] setNavigationBarHidden:YES animated:NO];
[[self navigationController] setToolbarHidden:NO animated:YES];
感謝。
我想通過類似的東西: self.navigationController.toolbar.frame = CGRectMake(0,18,320,45); 但我在頁面底部得到一個空的空間,而不是工具欄現在位於頂端....:S – 2010-06-09 16:59:58
對。這就是我的意思......有很多副作用,很多事情都希望酒吧處於最底層。不幸的是,我認爲你會發現目前只是不支持。 – DougW 2010-06-09 17:49:50