Reputation: 9923
Im having issue where i just using a simple UIBarButton and named it "Send" and white tint color using Storyboard
In viewdidload, i use this code to change the tint color to red, but it stay to white color, and only change to red after i press it 1 time and also, it become a bit smaller @-@ , cant figure out whats the problem here, i dont have any code before that can change the button
- (void)viewDidLoad
{
[super viewDidLoad];
[_sendEPinButton setTintColor:[UIColor redColor]];
center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(keyboardOnScreen:) name:UIKeyboardWillShowNotification object:nil];
[center addObserver:self selector:@selector(keyboardOffScreen:) name:UIKeyboardWillHideNotification object:nil];
CTTelephonyNetworkInfo *networkInfo = [[CTTelephonyNetworkInfo alloc] init];
CTCarrier *carrier = [networkInfo subscriberCellularProvider];
if (carrier.isoCountryCode.length == 0) {
self.geocoder = [[CLGeocoder alloc] init];
self.locationManager = [[CLLocationManager alloc] init];
if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) {
[self.locationManager requestAlwaysAuthorization];
}
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[self.locationManager startMonitoringSignificantLocationChanges];
// [self.locationManager startUpdatingLocation];
} else {
countryCodeString = carrier.isoCountryCode;
}
_contactTextfield.delegate = self;
[_contactTextfield setTintColor:colorFromRGB(67, 160, 48)];
}
In .h file
@property (strong, nonatomic) IBOutlet UIBarButtonItem *sendEPinButton;
Upvotes: 0
Views: 149
Reputation: 11201
Please put the code in ViewDidAppear method and see. Sometimes the outlets will not load properly in view did load method.
Upvotes: 1
Reputation: 864
you should write these line in viewdidload or where you created your UIBarButtonItem..
[_sendEPinButton setTintColor:[UIColor redColor]];
Upvotes: 0