I am using a custom class very similar to the Tweet Bot info panels in my application. I have this class working perfectly when a button is tapped, however what I am trying to achieve is getting this ‘alert panel’ to show when my application finishes launching or comes from being idle.
To call this class using a standard I am using the following code;
-(IBAction) button1Tapped:(id) sender
{
[MKInfoPanel showPanelInView:self.view
type:MKInfoPanelTypeInfo
title:@"Tweet Posted!"
subtitle:nil
hideAfter:2];
}
But I am having issues including this in my main AppDelegate.m. I keep getting an error message of ‘Property type view not found in Total_HealthAppDelegate when i use the following;
- (void)applicationWillEnterForeground:(UIApplication *)application
{
[MKInfoPanel showPanelInView:self.view
type:MKInfoPanelTypeInfo
title:@"Total:Health Support"
subtitle:@"Welcome"
hideAfter:3];
}
Any advice would be great
Try using
self.windowin place ofself.viewwhen this code is inside the AppDelegate. Also be sure to include the appropriate header files and declare the class.However, I recommend you put this code into the viewController that first wakes up instead. Here’s one way to accomplish this.
Set up a
BOOLinNSUserDefaultscalledjustWokeUp. Then, in the appDelegate, set it toYESwhen the app wakes up:Now, in any viewController that might be the first to load when the app resumes, check this value to see whether you should send the alert: