Discussion Forums  >  Plugins, Customizing, Source Code

Replies: 4    Views: 53

Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
01/08/15 10:32 AM (9 years ago)

rootDevice isIpad

Why will this not work for me??? if([appDelegate.rootDevice isIPad]){ } I can see it in nearly everyone else's plugin, but when i copy this line of code into a plugin I've built for myself i get a red error saying: "Use of undeclared identifier 'appDelegate" What am i missing? Do i need to import something else into my .m ? Thanks in advance Steve
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/08/15 10:55 AM (9 years ago)
ok so it accepts it in my viewdidload, but i want to put it within here - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { } However it doesn't recognise appdelegate as i start typing the if statement thoughts?
 
nadthevlad
Code is Art
Profile
Posts: 1025
Reg: Jun 07, 2012
Denver
21,850
like
01/08/15 03:35 PM (9 years ago)
you have to create the appdelegate before you can use it. Do this: BT_appDelegate *appDelegate = (BT_appDelegate *)[[UIApplication sharedApplication] delegate]; Then do your code: if([appDelegate.rootDevice isIPad]){ }
 
Bonzo
Apple Fan
Profile
Posts: 783
Reg: Jan 30, 2012
Basingstoke
13,530
like
01/09/15 02:30 AM (9 years ago)
perfect, thanks! i knew it would be something simple. Learn something new every day
 
ianJamesPiano
Code is Art
Profile
Posts: 2661
Reg: Feb 13, 2011
Palm Springs, C...
37,010
like
01/11/15 08:06 AM (9 years ago)
Just used this thanks:)
 

Login + Screen Name Required to Post

pointerLogin to participate so you can start earning points. Once you're logged in (and have a screen name entered in your profile), you can subscribe to topics, follow users, and start learning how to make apps like the pros.