2013-02-08 27 views
0

下面是我在工具欄下顯示UIView的代碼。它通過點擊工具欄上的按鈕來顯示。現在我想添加一個按鈕到彈出的UIView,以取消它。如果可能的話,導航欄上的按鈕使用戶界面更好? 任何人都可以指向我的教程嗎?如何將導航欄和UIButton添加到從底部滑動的UIView

-(void)likeButton:(UIBarButtonItem *)button 
{             
    CGRect frame = CGRectMake(0, 480, 320, 190); 
    frame.origin.y = CGRectGetMaxY(self.optionsToolBar.frame)-frame.size.height; 
    bottomView.frame = frame; 
    [self.optionsToolBar.superview insertSubview:bottomView    
             belowSubview:self.optionsToolBar]; 
} 
+0

,您在廈門國際銀行或代碼添加看法? – rptwsthi

+0

我添加查看代碼 – icodes

回答

2
-(void)likeButton:(UIBarButtonItem *)button 
    {             
     CGRect frame = CGRectMake(0, 480, 320, 190); 
     frame.origin.y = CGRectGetMaxY(self.optionsToolBar.frame)-frame.size.height; 
     bottomView.frame = frame; 

     UIView *navigationView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 44)]; 
     [navigationView setBackgroundColor:[UIColor blueColor]]; 
     UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; 
     [button setTitle:@"close" forState:UIControlStateNormal]; 
     [button addTarget:self action:@selector(closeView:) forControlEvents:UIControlEventTouchUpInside]; 
     [navigationView addSubView:button]; 
     [bottomView addSubView:navigationView]; 

     [self.optionsToolBar.superview insertSubview:bottomView    
            belowSubview:self.optionsToolBar]; 

    } 


    - (void) closeView :(id)sender{ 
     [[sender superView] removeFromSuperView];   
    } 
+0

thanx幫助..... – icodes

相關問題