J'ai un uibarbuttonitem, mais je l'ai initialisé en utilisant initwithcustomview. Je veux changer les arrière-plans en utilisant une image, mais je ne sais pas comment faire. J'utilisait la méthode de setBackground, comme celui-cichanger uibarbuttonitem arrière-plan en utilisant l'image
NSArray *segmentText = [segmentTextMutable copy];
UIImage *image = [[[UIImage alloc] init] autorelease];
image = [UIImage imageNamed:@"bunga.jpg"];
_docSegmentedControl = [[UISegmentedControl alloc] initWithItems:segmentText];
_docSegmentedControl.autoresizingMask = UIViewAutoresizingFlexibleHeight;
_docSegmentedControl.segmentedControlStyle = UISegmentedControlStyleBezeled;
[_docSegmentedControl addTarget:self action:@selector(docSegmentAction:) forControlEvents:UIControlEventValueChanged];
[_docSegmentedControl setBackgroundColor:[UIColor colorWithPatternImage:image]];
mais le UIBarButtonItem montre pas encore l'image, il est tout simplement changer l'arrière-plan de contrôle segmentée, pas le barbutton. Quelqu'un peut-il m'aider?
puis-je remplir tintColor avec une image? –