2010-07-26 6 views

답변

1

UINavigationBar가 후방 이동 또는 애플리케이션에 전달하는 데 사용된다 감사 이해 될 것이다. 다른 기능에는 사용할 수 없습니다. UIToolBar를 사용하여 네 개의 버튼을 표시하려면 어떻게해야합니까? 툴바는 기능이 다른 여러 개의 버튼을 가질 수 있습니다.

는`사용하여 도구 모음을 만들 새로운

toolbar = [UIToolbar new]; 
    toolbar.barStyle = UIBarStyleDefault; 
    [toolbar sizeToFit]; 
    toolbar.frame = CGRectMake(0, 410, 320, 50); 

    //Add buttons 
    UIBarButtonItem *systemItem1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
                       target:self 
                       action:@selector(pressButton1:)]; 

    UIBarButtonItem *systemItem2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction 
                       target:self 
                       action:@selector(pressButton2:)]; 

    UIBarButtonItem *systemItem3 = [[UIBarButtonItem alloc] 
    initWithBarButtonSystemItem:UIBarButtonSystemItemCamera 
    target:self action:@selector(pressButton3:)]; 

    //Use this to put space in between your toolbox buttons 
    UIBarButtonItem *flexItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace 
    target:nil 
    action:nil]; 

    //Add buttons to the array 
    NSArray *items = [NSArray arrayWithObjects: systemItem1, flexItem, systemItem2, flexItem, systemItem3, nil]; 

    //release buttons 
    [systemItem1 release]; 
    [systemItem2 release]; 
    [systemItem3 release]; 
    [flexItem release]; 

    //add array of buttons to toolbar 
    [toolbar setItems:items animated:NO]; 

    [self.view addSubview:toolbar];` 
관련 문제