Reputation: 211
I don't want to use the uialertview for the popup, that gives the user a chance to rate the app on ios. I want to use a customized popup, but this is not showing up. Besides using the iRate classes from the internet, I also create a xib, that contains the popup, that I want to appear and I changed in .h from :NSObject to :UIViewController. I commented all the code for the uialertview and in the method promptForRating, that will be triggered, I make the uiview from the xib visible, but apparently the uiview is nil.
- (void)promptForRating
{
rateView.hidden = NO;
}
Does anybody have a suggestion about making this popup show up?
Upvotes: 1
Views: 549
Reputation: 6190
I think I get it now.. if you want to display a view, it has to be embedded in a view controller. Or in another view that is already embedded.
What you can do is
At least this is what SVProgressHUD is doing.
Here is some sample code
if(!myView.superview){
NSEnumerator *frontToBackWindows = [[[UIApplication sharedApplication]windows]reverseObjectEnumerator];
for (UIWindow *window in frontToBackWindows)
if (window.windowLevel == UIWindowLevelNormal) {
[window addSubview:myView];
break;
}
}
The first line is to ensure that your view is not visible atm (maybe unnecessary in your context). To dismiss the view, remove it from its superview.
Upvotes: 2