I set my custom background in my AppDelegate.m
:
[self.window setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:@"background.png"]]];
And in my viewcontroller i make my custom button before adding it as a subview:
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
self.mainButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.mainButton setImage:[UIImage imageNamed:@"aButton"] forState:UIControlStateNormal];
[self.mainButton setImage:[UIImage imageNamed:@"aButton"] forState:UIControlStateHighlighted];
[self.mainButton setFrame:CGRectMake(100, 100, 300, 100)];
[self.view addSubview:self.mainButton];
}
Only my background is showing. If I remove the background - the button appears.
Set a pattern for UIViewController or just write a line