UIToolbar* toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 480-44, 320, 44)]; UIBarButtonItem* prevButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRewind target:self action:@selector(clickPrev)]; UIBarButtonItem* nextButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFastForward target:self action:@selector(clickNext)]; UIBarButtonItem* space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; [toolBar setItems:[NSArray arrayWithObjects:space, prevButton, space, nextButton, space, nil]];
それを均等にする方法
間にUIBarButtonSystemItemFlexibleSpaceを入れるだけ。
UIToolbar* toolBar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 480-44, 320, 44)]; UIBarButtonItem* prevButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemRewind target:self action:@selector(clickPrev)]; UIBarButtonItem* nextButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFastForward target:self action:@selector(clickNext)]; UIBarButtonItem* space = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; [toolBar setItems:[NSArray arrayWithObjects:space, prevButton, space, nextButton, space, nil]];
0 件のコメント:
コメントを投稿