У меня есть панель инструментов, и у меня есть 3 кнопки, я дал код, как показано ниже
UIButton *likeImage = [UIButton buttonWithType:UIButtonTypeCustom];
[likeImage setFrame:CGRectMake(0, 0, 30, 30)];
[likeImage setBackgroundImage:[UIImage imageNamed:@"likeIconDefault"] forState:UIControlStateNormal];
[likeImage addTarget:self action:@selector(likeImagePressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *likeImageButton = [[UIBarButtonItem alloc] initWithCustomView:likeImage];
UIButton *commentImage = [UIButton buttonWithType:UIButtonTypeCustom];
[commentImage setFrame:CGRectMake(200, 0, 30, 30)];
[commentImage setBackgroundImage:[UIImage imageNamed:@"commentIcon"] forState:UIControlStateNormal];
[commentImage addTarget:self action:@selector(commentImagePressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *commentImageButton = [[UIBarButtonItem alloc] initWithCustomView:commentImage];
UIButton *dislikeImage = [UIButton buttonWithType:UIButtonTypeCustom];
NSArray *buttonItems = [NSArray arrayWithObjects: likeImageButton, commentImageButton, nil];
положение кнопки не меняется даже после задания различных значений для координат X и Y