Reputation: 23
I'm trying to create a button on my custom keyboard. Here's the code I'm currently using:
CGRect ss = [[UIScreen mainScreen] bounds];
self.q = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[self.q setBackgroundImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
[self.q setTitle:@"Q" forState:UIControlStateNormal];
[self.q.titleLabel setTextColor:[UIColor whiteColor]];
self.q.titleLabel.font = [UIFont systemFontOfSize:30];
[self.q setFrame:CGRectMake(0*ss.size.width/10, 0, ss.size.width/10,self.view.bounds.size.height/4)];
[self.q addTarget:self action:@selector(size:) forControlEvents:UIControlEventTouchDown];
[self.view addSubview:self.q];
The problem is that self.view.bounds.size.height seems to be returning 0, when it should be returning the height of the keyboard view. There is a similar question to this, but I have tried the answers and none have worked.
Upvotes: 0
Views: 52