lundi 23 mars 2015

UIButton is not working on iPhone4

I am creating a UIButton programatically and when I text it on iPhone 6 it works almost ok, but on iPhone 5 it starts to work harder and on iPhone 4/ 4s it doesn't work at all. It acts like the inside tapping area is getting smaller and smaller by device. I want to mention that the UI looks the same, here is the code I am using:



//add second signIn button
int secondSignInButtonXPossition = 0.f;
int secondSignInButtonYPossition = [[UIScreen mainScreen] bounds].size.height;
int secondSignInButtonWidth = [[UIScreen mainScreen] bounds].size.width;
int secondSignInButtonHeight = [[UIScreen mainScreen] bounds].size.height * 0.1;
secondSignInButton = [[UIButton alloc] initWithFrame:CGRectMake(secondSignInButtonXPossition, secondSignInButtonYPossition, secondSignInButtonWidth, secondSignInButtonHeight)];
[secondSignInButton addTarget:self
action:@selector(secondSignInButtonFunction)
forControlEvents:UIControlEventTouchUpInside];
secondSignInButton.backgroundColor = [UIColor colorWithRed:(10/255.f) green:(174/255.f) blue:(250/255.f) alpha:1];
secondSignInButton.font = [UIFont systemFontOfSize:27.0f];
[self.view addSubview:secondSignInButton];
[secondSignInButton setTitle:@"Sign In" forState:UIControlStateNormal];
[secondSignInButton setHidden:YES];

//add exit button
dismisSignInViewButton = [[UIButton alloc] init];
dismisSignInViewButton.frame = CGRectMake([[UIScreen mainScreen] bounds].size.width * 0.87, [[UIScreen mainScreen] bounds].size.height * 0.07, 31, 31);
dismisSignInViewButton.backgroundColor = [UIColor redColor];
[dismisSignInViewButton addTarget:self
action:@selector(dismisSignInViewButtonFunction)
forControlEvents:UIControlEventTouchUpInside];
[dismisSignInViewButton setBackgroundImage:[UIImage imageNamed:@"exitButton.png"] forState:UIControlStateNormal];
[self.view addSubview:dismisSignInViewButton];
[dismisSignInViewButton setEnabled:YES];
[dismisSignInViewButton setHidden:NO];


I also tried to see if it works with/ without enable and hidden property and it didn't work, any idea where the bug may be?




Aucun commentaire:

Enregistrer un commentaire