如何在CMFCCaptionBar添加多个按钮

2024-11-18 14:00:08
推荐回答(1个)
回答1:

Mads Mobæk:给UINavigationBar添加按钮的示例代码   12345678 UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:nil action:nil];UINavigationItem *item = [[UINavigationItem alloc] initWithTitle:@"Title"];item.rightBarButtonItem = rightButton;item.hidesBackButton = YES;[bar pushNavigationItem:item animated:NO];[rightButton release];[item release];   但是通常你得有一个Navigation Controller,使你能够写如下代码:   1234 UIBarButtonItem *rightButton = [[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleDone target:nil action:nil];self.navigationItem.ri...