-(void) onSetting:(id) sender {
SplitBaseController *detail = [[SettingServerController alloc] init]; CGRect frame = [(UIView *)sender frame]; frame.origin.y = 0; UIPopoverController *popwin = [[UIPopoverController alloc] initWithContentViewController:detail]; [popwin setPopoverContentSize:CGSizeMake(400, 300) animated:YES]; popwin.delegate = self; [popwin presentPopoverFromRect: frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; [detail release];
在UINavigationBar中添加左箭头返回按钮在iPhone里面最讨厌的控件之一就是 UINavigationBar了。这个控件样式修改不方便,连添加按钮也特别麻烦。下面的例子是如何手动添加带箭头的按钮:
UINavigationItem *item = [navBar.items objectAtIndex:0];UINavigationItem *back = [[UINavigationItem alloc] initWithTitle:@"Back"];NSArray *items = [[NSArray alloc] initWithObjects:back,item,nil];[navBar setItems:items];- (BOOL)navigationBar:(UINavigationBar *)navigationBarshouldPopItem:(UINavigationItem *)item{//在此处添加点击back按钮之后的操作代码return NO;}(void) onSetting:(id) sender {
SplitBaseController *detail = [[SettingServerController alloc] init]; CGRect frame = [(UIView *)sender frame]; frame.origin.y = 0; UIPopoverController *popwin = [[UIPopoverController alloc] initWithContentViewController:detail]; [popwin setPopoverContentSize:CGSizeMake(400, 300) animated:YES]; popwin.delegate = self; [popwin presentPopoverFromRect: frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; [detail release];
本文介绍如何在iOS应用中创建一个从UINavigationBar触发的UIPopoverController弹窗,并展示了如何手动添加带有返回箭头的导航项。

429

被折叠的 条评论
为什么被折叠?



