I stumbled across a lovely ui concept. I am wondering how could we create a "pop up" window like this in iOS(iPhone).
I have 3 questions:
Thank you
EDIT: I would like to create a custom control like this.
It seems that the better way is to:
1- Create a class that inherits UIView
and has a delegate
class too.
your .h file should be something like this:
#import <UIKit/UIKit.h>
@class MYPopUpView;
//Your delegate class
@protocol PopUpViewDelegate <NSObject>
- (void) popUpView:(MYPopUpView *)popUpView clickedButtonAtIndex:(NSInteger) index;
@end
//Your view interface
@interface LIPopUpView : UIView{
NSObject<LIPopUpViewDelegate> *_delegate;
}
//Your methods and properties
@end
2- In the initializer of your .m file implement the UI of your PopUpView
3- For the circle you can use UILayer or even a custom button and when user clicks it fire your delegate
methods.
4- Define a show methods with following code for showing the popUp:
- (void) show
{
UIWindow *window = [UIApplication sharedApplication].windows.lastObject;
[window addSubview:self];
[window bringSubviewToFront:self];
}
5- Fire the show method of you popUp object to show the popUp
6- For hiding it, define the close methods like below and fire it from the caller class.
- (void) close
{
[self removeFromSuperview];
}