-(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 *)navigationBar
shouldPopItem:(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];