I have defined the width, height and position of a custom UIButton
in the viewDidLoad
section of my implementation file. If I were to drag and drop this button in the IB, I could ctrl and drag it to another View Controller and select PopOver
.
Unless there is a way to attach an IBOutlet
to this custom UIButton
which I'm unaware of, as my custom button doesn't show in the Interface Builder, how do I go about calling a PopOver
of a UIViewController
within the action of clicking my custom UIButton
in my implementation file?
This is how I defined my custom button:
self.hard1 = [UIButton buttonWithType:UIButtonTypeCustom];
[self.hard1 setFrame:CGRectMake(884, 524, 105, 60)]; // set the x,y,width and height
UIImage *buttonImage = [UIImage imageNamed:@"green.jpg"];
self.hard1.layer.cornerRadius = 10;
self.hard1.clipsToBounds = YES;
[self.hard1 addTarget: self
action: @selector(buttonTapped:)
forControlEvents: UIControlEventTouchUpInside];
[self.hard1 setImage:buttonImage forState:UIControlStateNormal];
[self.view addSubview:self.hard1];