0

그녀의 바 버튼을 3 개 만들고 오른쪽 탐색 항목에 지정하려고합니다. 그 사이에 공간을 갖고 싶습니다. 코드에 공간이 거의없고, 더 넓게 만들려고 노력했지만 얻지는 못했습니다. 내 코드바 버튼 사이의 간격

UIBarButtonItem *actionBarButton = [UIBarButtonItem.alloc initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(presentActivity)]; 
self.navigationItem.leftBarButtonItem = backButton; 
UIBarButtonItem *prevBarButton = [UIBarButtonItem.alloc initWithImage:MHGalleryImage(@"left_arrow.png") style:UIBarButtonItemStyleBordered target:self action:@selector(prevButtonAction:)]; 
UIBarButtonItem *nextBarButton = [UIBarButtonItem.alloc initWithImage:MHGalleryImage(@"right_arrow.png") style:UIBarButtonItemStyleBordered target:self action:@selector(nextButtonAction:)]; 
UIBarButtonItem *flex = [UIBarButtonItem.alloc initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace target:self action:nil]; 
self.navigationItem.rightBarButtonItems = @[actionBarButton, flex, flex, flex, flex, flex, flex, flex, flex, flex, flex, flex, flex, nextBarButton, flex, flex, flex, flex, flex, flex, prevBarButton, flex]; 
+0

가능한 중복 [? 버튼 사이에 공간을 만드는 방법 (http://stackoverflow.com/questions/7633066/how-to-create-between-between-buttons) – Paulw11

답변

0

은 명시 적으로 같은 flex 바 버튼 항목의 폭을 정의

UIBarButtonItem *flex = [UIBarButtonItem.alloc initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpace 
                    target:nil 
                    action:nil]; 
NSLog(@"before -- %f",flex.width); 
flex.width = 44; 
NSLog(@"after -- %f",flex.width); 

self.navigationItem.rightBarButtonItems = @[actionBarButton, flex, nextBarButton, flex, prevBarButton, flex];