Reputation: 359
I want to show a pop up window in my iPhone app whenever I receive a push notification through didRecieveRemoteNotification
. Something like the windows shown in the image attached. I tried doing addSubview
with my view controller, but it occupies the entire screen. How do I create the pop-ups?
Upvotes: 1
Views: 937
Reputation: 5314
Instead of adding a subview with dimensions of the screen {320x460}
, create a view with smaller dimensions such as {100,100}
and add rounded corners to them via the UIView
layer
properties
#import <QuartzCore/QuartzCore.h>
....
view.layer.cornerRadius = 5;
view.layer.masksToBounds = YES;
UPDATE: To achieve the background dim effect, contradicting to what I first suggested. Add your PopUp view to a view with a frame of the full screen dimensions {320,460}
. You then apply a transparency color to it via the UIColor
-colorWithWhite:alpha:
method. Like below:
view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
Upvotes: 2