I am having a toolbar and in that i have 3 buttons i gave the code as below
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];
position of the button is not changing even after giving different values for X and Y coordinates