Exactly what it says on the tin. I'm updating an app to support iOS 8+. AFAIK, this works fine on iOS 7. Works as well in the simulator (iOS 7 or 8).
Here's the code for one of the buttons in the viewDidLoad:
memberButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
memberButton.frame = CGRectMake(20, screenHeight - 50, 133, 24);
[memberButton setBackgroundColor:[UIColor colorWithRed:70.0/255.0 green:70.0/255.0 blue:70.0/255.0 alpha:1]];
[memberButton setBackgroundImage:[UIImage imageNamed:@"Member.png"] forState:UIControlStateNormal];
[memberButton setTintColor:[UIColor whiteColor]];
[memberButton addTarget:self action:@selector(memberButtonPressed) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:memberButton];
memberButton.hidden = NO;
memberButton.enabled = YES;
Upon running the app on the phone, the button is nowhere to be found. Obviously there's a lot more on that app than a single button; there's an image you can scroll through. Could that be responsible?
Here's the code for the advertisement style scrolling image:
pgCtr = [[UIPageControl alloc] initWithFrame:CGRectMake(160, screenHeight - 70, 0, 0)];
[pgCtr setTag:0];
pgCtr.numberOfPages=3;
pgCtr.autoresizingMask=UIViewAutoresizingNone;
[self.view addSubview:pgCtr];
for (int i=1; i<=3; i++) {
pgCtr.currentPage = i;
UIImage *image = [UIImage imageNamed:[NSString stringWithFormat:@"intro_%d.jpg",i]];
UIImageView *imgV = [[UIImageView alloc] initWithFrame:CGRectMake((i-1)*scr.frame.size.width, 0, scr.frame.size.width, scr.frame.size.height)];
imgV.contentMode=UIViewContentModeScaleToFill;
[imgV setImage:image];
imgV.tag=i+1;
[scr addSubview:imgV];
}
[scr setContentSize:CGSizeMake(scr.frame.size.width*3, scr.frame.size.height)];
pgCtr.currentPage = 0;
pgCtr.currentPageIndicatorTintColor = [UIColor whiteColor];
pgCtr.pageIndicatorTintColor = [UIColor grayColor];
Things I tried (latest in bold):
- Setting CGRectMake(20, screenHeight - 50, 133, 24) to static values.
- Putting the scrollview code above the button codes.
- Commenting out the entire scrollview.
- Output member.frame.origin.x and .y. In simulator, both return values. In the phone, both return 0.00000.
None has displayed the buttons.