2011-08-29 75 views

回答

0

取消按鈕(如果這就是你指的)是UINavigationController的導航欄的rightBarButtonItem。您可以將其設置爲標準UIBarButtonItem(如此處所示)或自定義標準(您可以創建其視圖)。

HTH,

阿克沙伊

+0

@阿克沙伊是它指的是CANCLE按鈕...什麼HTH? – user891268

+0

希望這有助於。 – Akshay

2
UIViewController* popoverContent = [[UIViewController alloc] init]; 
    UIView *popoverView = [[UIView alloc] init]; 
    popoverView.backgroundColor = [UIColor blackColor]; 
    UIToolbar *toolbar=[[UIToolbar alloc] initWithFrame:CGRectMake(0, 0,400 ,44)]; 
    toolbar.barStyle =UIBarStyleBlackTranslucent; 
    NSMutableArray *ButtonArray=[[NSMutableArray alloc ]init]; 
    Save=[[UIBarButtonItem alloc ]initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(save_pressed)]; 
    UIBarButtonItem *space=[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; 
    UIBarButtonItem *cancel=[[UIBarButtonItem alloc ]initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancel_pressed)]; 

    [ButtonArray addObject:cancel]; 
    [cancel release]; 
    [ButtonArray addObject:space]; 
    [space release]; 
    [ButtonArray addObject:Save]; 
    [Save release]; 
    [toolbar setItems:ButtonArray]; 
    [ButtonArray release]; 
    [popoverView addSubview:toolbar]; 
    [toolbar release]; 
    picker = [[UIPickerView alloc] init]; 
    picker.frame = CGRectMake(0, 44, 400, 340); 
    picker.delegate = self; 
    picker.dataSource = self; 
    picker.showsSelectionIndicator = YES; 
    [popoverView addSubview:picker]; 
    popoverContent.view = popoverView; 
    popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent]; 
    [popoverController setPopoverContentSize:CGSizeMake(400, 264) animated:NO]; 
    [popoverController presentPopoverFromRect:btn.frame inView:scr_AddLocation permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; 
    [popoverView release]; 
    [popoverContent release]; 
here I m adding Picker To Popover When We Pressed Button . 
相關問題