How to pass a UIButton's frame and origin between ViewControllers - ios

I want to do an animation that zooms in from a calendar, specifically with the origin and frame size being that of the button that represent's today's date. Here is the code for determining the todayButton inside CalendarMonthView.m:
NSDate *date = (weekdayOffset > 0) ? [_monthStartDate dateByAddingTimeInterval:-1 * weekdayOffset * D_DAY] : _monthStartDate;
BOOL bEnabled = (weekdayOffset == 0);
CGRect buttonFrame = CGRectMake (0, 0, 81, 61);
int idx = -1 * weekdayOffset;
for (int y = 0; y < 6; y++) {
buttonFrame.origin.x = 0;
for (int x = 0; x < 7; x++) {
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
button.tag = idx++;
[button setFrame:buttonFrame];
[button setBackgroundImage:[UIImage imageNamed:#"calendarFlyout_dayContainer_today.png"] forState:UIControlStateSelected];
[button setBackgroundImage:[UIImage imageNamed:#"calendarFlyout_selected.png"] forState:UIControlStateHighlighted];
button.titleLabel.font = [UIFont fontWithName:#"TitilliumWeb-Regular" size:18.0];
button.titleLabel.textAlignment = NSTextAlignmentCenter;
// TODO: optimize performance
int dayOfMonth = (int)[_calendar component:NSCalendarUnitDay fromDate:date];
if (dayOfMonth < prevDayOfMonth) {
bEnabled = !bEnabled;
}
prevDayOfMonth = dayOfMonth;
[button setTitle:[NSString stringWithFormat:#"%d", dayOfMonth] forState:UIControlStateNormal];
[button setTitleColor:[UIColor darkGrayColor] forState:UIControlStateNormal];
[button setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateHighlighted];
[button setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
[button setBackgroundImage:[UIImage imageNamed:((bEnabled) ? #"calendarFlyout_dayContainer_insideMonth.png"
: #"calendarFlyout_dayContainer_outsideMonth.png")]
forState:UIControlStateNormal];
// button.enabled = bEnabled;
button.selected = [date isToday];
if (button.selected == NO) {
button.highlighted = (_currentDayDate) ? [date isEqualToDateIgnoringTime:_currentDayDate] : NO;
} else {
// Set buttonHolder to today
}
[button addTarget:self action:#selector (dayButtonTapped:) forControlEvents:UIControlEventTouchUpInside];
[_dayButtonsHolderView addSubview:button];
buttonFrame.origin.x += buttonFrame.size.width;
date = [date dateByAddingTimeInterval:D_DAY];
}
buttonFrame.origin.y += buttonFrame.size.height;
}
- (IBAction)dayButtonTapped:(id)sender
{
if (_delegate) {
UIButton *button = (UIButton *)sender;
NSDate *selectedDate = [_monthStartDate dateByAddingDays:button.tag];
[_delegate performSelector:#selector (calendarMonthView:dateSelected:) withObject:self withObject:selectedDate];
}
}
I want to get the frame of button and use it in this animation used in CalendarFlyoutView.m.
I'm new to iOS programming and I read up on some delegate information and passing information through segues, but it doesn't seem to help me here.
Any help would be greatly appreciated.

Use the transform feature.
// animate in year calendar
_yearCalendarView.hidden = NO;
self.curMonthView.monthLabel.hidden = YES;
CalendarMonthView *monthView = [CalendarMonthView new];
monthView.delegate = self;
CGRect buttonFrame = _currentDayButtonFrame;
_yearCalendarView.frame = CGRectMake(buttonFrame.origin.x, buttonFrame.origin.y + buttonFrame.size.height, buttonFrame.size.width, buttonFrame.size.height);
NSLog(#"_yearCalendarView frame: %#", NSStringFromCGRect(_yearCalendarView.frame));
_yearCalendarView.transform = CGAffineTransformMakeScale(0.01, 0.01);
[UIView animateWithDuration:kAnimation_ExpandCalendarDuration delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
_yearCalendarView.transform = CGAffineTransformIdentity;
_yearCalendarView.frame = CGRectMake(_monthSwiperScrollView.frame.origin.x, _monthBarImageView.frame.size.height + 20, _monthSwiperScrollView.frame.size.width + 2, _yearFlyoutHeight);
} completion:^(BOOL finished) {
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:#selector (yearCalendarAnimationDidStop:finished:context:)];
}];

If you are making a segue from the CalendarMonthView to the CalendarFlyoutView then you can just add this method to the CalendarMonthView.
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
CalendarFlyoutView * view = segue.destinationViewController;
view.buttonFrame = button.frame;
}
and in your CalendarFlyoutView.h
#interface CalendarFlyoutView : UIViewController
#property CGRect buttonFrame;
#end

A couple of questions that need to be answered to best help you:
1) Are CalendarMonthView and CalendarFlyoutView UIView or UIViewController? You say view controller, but the class name says otherwise.
2) What is happening in the method 'dayButtonTapped'? Are you performing a segue there? Are you somehow creating or loading an instance of CalendarFlyoutView?
3) If you are not using a segue, are you somehow creating and add a child view controller for CalendarFlyoutView to CalendarMonthView?
4) What is the desired transition (your animation)? Does the CalendarFlyoutView start at the same size as the button, then fill the whole screen?
5) Is there a specific reason that you are setting the button's frame instead of constraining it in the correct place?
Once we know a little more about these questions we should be able to provide some more concrete suggestions.

It's still not very clear where the actual animation code is being run. In your question, you state "I want to get the frame of button and use it in this animation used in CalendarFlyoutView.m." which seems to imply the animation code is in CalendarFlyoutView, which seems like an odd place for it.
There are a few things I could recommend, given my incomplete understanding of the whole of the code:
1) Move the animation code to the dayButtonTapped method, where you already have a reference to the button, and therefore it's frame. It also seems like a more logical place for it.
2) Where ever you are instantiating the CalendarFlyoutView (not shown in the code you posted), assign the button frame there.
3) If there is only a single instance of CalendarFlyoutView and you have a reference to it in CalendarMonthView, you could assign a property of the flyout view that is the frame of the button you already have a reference to in the dayButtonTapped method.
I have to add though, that these are just work arounds to what seems like a structural issue. Is this a reusable control you are trying to write? Why did you decide to not use the storyboard or view controllers? Why are you using frames and absolute sizes and positions at all instead of letting auto layout do it's job (you will bang your head against the wall for hours trying to tweak everything to run correctly in all orientations and all possible device screen sizes).

Related

Showing Selected Buttons if Back button is Pressed [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
On first Page i am having some buttons , if i press any button it will move to Second page , here if i press back button in the navigation bar it will move to first page
i have created the buttons dynamically based on the array count ,i want to show the selected button when i move back to first page , how can i do this ?Please help me to do this .here is the code that i have used for creating buttons
int buttonheight = 30;
int horizontalPadding = 20;
int verticalPadding = 20;
int totalwidth = self.view.frame.size.width;
int x = 10;
int y = 150;
for (int i=0; i<array.count; i++)
{
NSString* titre = [array objectAtIndex:i];
//
CGSize contstrainedSize = CGSizeMake(200, 40);//The maximum width and height
NSDictionary *attributesDictionary = [NSDictionary dictionaryWithObjectsAndKeys:
[UIFont systemFontOfSize:20.0], NSFontAttributeName,
nil];
CGRect frame = [titre boundingRectWithSize:contstrainedSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attributesDictionary context:nil];
int xpos = x + CGRectGetWidth(frame);
if (xpos > totalwidth) {
y =y +buttonheight+ verticalPadding;
x = 10;
}
UIButton * word= [UIButton buttonWithType:UIButtonTypeRoundedRect];
self.word = word;
NSLog(#"%#", NSStringFromCGRect(frame));
word = [UIButton buttonWithType:UIButtonTypeRoundedRect];
word.frame = CGRectMake(x, y, CGRectGetWidth(frame)+5, CGRectGetHeight(frame));
[word setTitle:titre forState:UIControlStateNormal];
word.backgroundColor = [UIColor colorWithRed:30.0/255.0 green:134.0/255.0 blue:255.0/255.0 alpha:1.0];
[word setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[word setTag:i];
[word addTarget:self action:#selector(btn1Tapped:) forControlEvents:UIControlEventTouchUpInside];
word.layer.borderColor = [UIColor blackColor].CGColor;
word.layer.borderWidth = 1.0f;
word.layer.cornerRadius = 5;
[self.view addSubview:word];
x =x+horizontalPadding+CGRectGetWidth(frame);
}
- (IBAction)btn1Tapped:(id)sender {
NSString *btnTitle;
btnTitle = [(UIButton *)sender currentTitle];
NSLog(#"%#",self.title);
ReasonViewController *ReasonVC = [self.storyboard instantiateViewControllerWithIdentifier:#"ReasonVC"];
ReasonVC.btnTitle = btnTitle;
NSLog(#"%#",self.imageArray);
ReasonVC.imageArray1 = self.imageArray;
[self.navigationController pushViewController:ReasonVC animated:YES];
}
=====Appdelegate.h========
#property (assign, nonatomic) long int btnTag;
=======CategoryViewController.h============
import "AppDelegate.h"
#interface CategoryViewController : UIViewController
{
AppDelegate *appdel;
}
===========CategoryViewController.m=======
add code
if(appdel.btnTag == word.tag)
{
word.selected = YES;
}
below [word setTag:i]; code
then add
UIButton *btn = (UIButton *) sender;
appdel.btnTag = btn.tag;
in - (IBAction)btn1Tapped:(id)sender method
The UIButton object has different states included the "Selected state". You can set different background image or title for each state you want. When you press it you can change its state like this:
//After you inited your UIButton Object do this:
[button setBackgroundImage:selectedBGImage forState:UIControlStateSelected];
[button setBackgroundImage:deselectedBGImage forState:UIControlStateNormal];
//You can also find the title change method for state accordingly
- (void)buttonAction:(UIButton *)sender
{
sender.selected = !sender.selected;
//TODO
}
So, when you pop back, the button will keep its "selected" state.
You have to store button tag in appdelegate and while creating button check with button tag/i values and do selected. please see below code
in AppDelegate.h
#property (assign, nonatomic) int btnTag;
create an object of AppDelegate on your current ViewController then
AppDelegate *appdel = (AppDelegate *)[[UIApplication sharedApplication] delegate];
int buttonheight = 30;
.
.
.
[word setTag:i];
if(word.tag == appdel.btnTag)//appdel is object of AppDelegate
{
word.selected = YES;
}
[word addTarget:self action:#selector(btn1Tapped:) forControlEvents:UIControlEventTouchUpInside];
word.layer.borderColor = [UIColor blackColor].CGColor;
word.layer.borderWidth = 1.0f;
word.layer.cornerRadius = 5;
[self.view addSubview:word];
x =x+horizontalPadding+CGRectGetWidth(frame);
}
- (IBAction)btn1Tapped:(id)sender {
UIButton *btn = (UIButton *) sender;
appdel.btnTag = btn.tag;
NSString *btnTitle;
btnTitle = [(UIButton *)sender currentTitle];
NSLog(#"%#",self.title);
ReasonViewController *ReasonVC = [self.storyboard instantiateViewControllerWithIdentifier:#"ReasonVC"];
ReasonVC.btnTitle = btnTitle;
NSLog(#"%#",self.imageArray);
ReasonVC.imageArray1 = self.imageArray;
[self.navigationController pushViewController:ReasonVC animated:YES];
}
enter image description here
I am getting like below screenshot , if i tapped any button it will move to next page and the backgroundcolor is changed to red color,and come back to same page by clicking back and now i tapped another button it is also showing in red color.
I have use this two lines in button action method :
UIButton *btn = (UIButton *) sender;
[btn setBackgroundColor:[UIColor redColor]];

override the fullscreen tap or hide the fullscreen button -MPMoviePlayerController

When using the MPMoviePlayerController I want to override fullscreen button tap or to hide it so I can add a custom button.
The mission is to really change the MPMoviePlayerController frame and other subviews frame.
Any ideas? Or I must use different video player to accomplish that?
First of all remove gestures of your MPMoviePlayerController. Then add your custom gestures or Button or other control.
self.player.view.gestureRecognizers = nil;
//Add your custom gestures or Button or other control
I recently was solving similar issue. My client was insisting to disable Previous and Next buttons although I was strongly recommend to do that because it's quite tricky and not guaranteed to work in next iOS version. So here I publish my solution as an very unwanted option)
-(void) disableNextPrevButtons:(UIView *) view :(int) level {
Class cl = NSClassFromString(#"MPKnockoutButton");
for (UIView * v in view.subviews) {
NSLog(#"[%d] scanning view of class %# tag: %ld", level, NSStringFromClass(v.class), (long)v.tag);
if ([v isKindOfClass:cl]) {
for (UIView * v2 in v.subviews)
if ([v2 isKindOfClass:[UIImageView class]]) {
v.alpha = 0.0;
v.userInteractionEnabled = NO;
if (!buttonsDiscovered) {
buttonsDiscovered = YES;
UIButton * b = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, v.superview.frame.size.height, v.superview.frame.size.height)];
if (MLGSystemVersion() > 7.9)
b.alpha = 0.5;
b.autoresizingMask = (UIViewAutoresizingFlexibleLeftMargin |
UIViewAutoresizingFlexibleRightMargin |
UIViewAutoresizingFlexibleTopMargin |
UIViewAutoresizingFlexibleBottomMargin);
[b setImage:[UIImage imageNamed:#"btnMPPause.png"] forState:UIControlStateNormal];
[b setImage:[UIImage imageNamed:#"btnMPPlay.png"] forState:UIControlStateSelected];
b.selected = YES;
[b addTarget:self action:#selector(btnPlayPauseDidPress:) forControlEvents:UIControlEventTouchUpInside];
b.center = CGPointMake(v.superview.frame.size.width / 2, v.center.y);
[v.superview addSubview:b];
self.btnPlayPause = b;
}
break;
}
} else
[self disableNextPrevButtons:v :level +1];
}
}
The method is recursevely scans and finds the desired controls and do some bad things to them

UIButton not showing up in SKScene

I'm trying to write some methods which can be used to generate labels, images, buttons etc.. in my spritekit project.
I call my setUPScene method in the initWithSize method and in the setUpScene method I call three methods to set label, image and button.
My label and image appears on the main scene but I can't succeed to appear UIButton type button. Actually I seek for some error but I think everything seems right. Here are my methods;
-(void) setUpMainScene {
self.backgroundColor = [SKColor colorWithRed:1.0 green:0.15 blue:0.3 alpha:1.0];
[self addChild:[self createLabel:#"Vecihi"
labelFontName:#"Chalkduster"
labelFontSize:20
labelPositionX:CGRectGetMidX(self.frame)
labelPositionY:CGRectGetMidY(self.frame)]];
[self addChild:[self createImage:#"Spaceship"
imagePositionX:CGRectGetMidX(self.frame)
imagePositionY:CGRectGetMidY(self.frame)+60
imageWidth:40.0
imageHeight:60.0]];
[self.view addSubview:[self createButton:#"ButtonSample.png"
setTitleColor:[UIColor whiteColor]
buttonPositionX:(CGRectGetMidX(self.frame))
buttonPositionY:(CGRectGetMidY(self.frame)-200.0)
buttonWidth:200.0
buttonHeight:70.0]];
}
//Create any label with given parameters
-(SKLabelNode *) createLabel:(NSString *) labelTitle labelFontName:(NSString *) fontName labelFontSize:(int)fontSize labelPositionX:(CGFloat) x labelPositionY:(CGFloat) y {
SKLabelNode *myLabel = [SKLabelNode labelNodeWithFontNamed:fontName];
myLabel.text = labelTitle;
myLabel.fontSize = fontSize;
myLabel.position = CGPointMake(x,y);
return myLabel;
}
//Create any image with given parameters
-(SKSpriteNode *) createImage:(NSString *) imageName imagePositionX:(CGFloat) x imagePositionY:(CGFloat) y imageWidth:(CGFloat) width imageHeight:(CGFloat) height {
SKSpriteNode *myImage = [SKSpriteNode spriteNodeWithImageNamed:imageName];
myImage.position = CGPointMake(x, y);
myImage.size = CGSizeMake(width, height);
return myImage;
}
//Create any button wtih given parameters
-(UIButton *) createButton:(NSString *) buttonImage setTitleColor:(UIColor *) titleColor buttonPositionX:(CGFloat) x buttonPositionY:(CGFloat) y buttonWidth:(CGFloat) width buttonHeight:(CGFloat) height {
UIButton *myButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
NSLog(#"%#", buttonImage);
myButton.frame = CGRectMake(x, y, width, height);
myButton.backgroundColor = [UIColor clearColor];
[myButton setTitleColor:titleColor forState:UIControlStateNormal];
[myButton setBackgroundImage:[UIImage imageNamed:buttonImage] forState:UIControlStateNormal];
return myButton;
}
The reason your code does not work, is because the scene's view property is set to nil, when initWithSize: is called.
You could handle this by moving the UI initialization code to the scene's didMoveToView: method. Then, in willMoveFromView:, you can perform cleanup (i.e. remove the UIButton from the view).
That way your scene-specific UI code stays in the scene, and doesn't clutter up the viewcontroller code. Especially, if you decide to add UI controls to multiple scenes - you only have one viewcontroller, and it could become messy fast.
You have to setup the button in the viewcontroller owning the scene, NOT the scene itself.
So, move
[self.view addSubview:[self createButton:#"ButtonSample.png"
setTitleColor:[UIColor whiteColor]
buttonPositionX:(CGRectGetMidX(self.frame))
buttonPositionY:(CGRectGetMidY(self.frame)-200.0)
buttonWidth:200.0
buttonHeight:70.0]];
in SampleScene.m
to SampleViewController.m like this
- (void) viewDidLoad {
[self.view addSubview:[self.scene createButton:#"ButtonSample.png"
setTitleColor:[UIColor whiteColor]
buttonPositionX:(CGRectGetMidX(self.view.frame))
buttonPositionY:(CGRectGetMidY(self.view.frame)-200.0)
buttonWidth:200.0
buttonHeight:70.0]];
//More commands not shown...
}
Please note the changes in the button positioning, and button creation
Replacing SamplesScene & SampleViewController to their corresponding names of course

UIButton suddenly stops working

So I'm having issues with the buttons for the filters in my photo app. I'm not exactly sure why, but they've suddenly stopped working. The selector is not being called when they're tapped, but I have no idea why. They were working just fine a few days ago, but for some reason they're not now. I've checked the UIView subviews array, verified that it's right on top. I need a way to see if, for some reason, the touches are not making it to the button. I'm not sure how to do this.
I wish I had more information to give, but this is all I've got. I hope someone has some suggestions because I'm at wit's end with it.
Thanks in advance!
Button Creation Method:
-(void)createFilterButtonsForThumbnail:(UIImage *)thumbnail
{
UIView *filtersContainer = self.filterContainer;
CGRect buttonFrame = CGRectMake(kFilterFrameThickness, kFilterFrameThickness,
thumbnail.size.width, thumbnail.size.height);
CGFloat frameWidth = thumbnail.size.width+(2*kFilterFrameThickness);
CGFloat frameHeight = kFilterPickerHeight;
UIEdgeInsets backgroundInsets = UIEdgeInsetsMake(0, kFilterFrameThickness, 0, kFilterFrameThickness);
UIImage *buttonBackgroundImage = [[UIImage imageNamed:#"FilmReel"] resizableImageWithCapInsets:backgroundInsets];
for (int i = 0;i<(self.filterPaths.count+kFilterNonLookups+1);i++){
UIImageView *buttonBackground = [[UIImageView alloc] initWithFrame:CGRectMake(kFilterSidePadding+(i*(frameWidth+kFilterSidePadding)),
0,
frameWidth,
frameHeight)];
[buttonBackground setImage:buttonBackgroundImage];
UIButton *thumbnailButton = [[UIButton alloc] initWithFrame:buttonFrame];
UIImage *filteredThumbnail = [self applyFilterAtIndex:i ToImage:thumbnail];
[thumbnailButton setImage:filteredThumbnail forState:UIControlStateNormal];
[thumbnailButton addTarget:self action:#selector(filterSelected:) forControlEvents:UIControlEventTouchUpInside];
[thumbnailButton setTag:i];
[buttonBackground addSubview:thumbnailButton];
[filtersContainer addSubview:buttonBackground];
if ((i > (kFilterProMinimumIndex)) && ([self isProVersion]) == NO){
UIImageView *proTag = [[UIImageView alloc] initWithImage:nil];
CGRect proFrame = CGRectMake(buttonFrame.origin.x,
buttonFrame.origin.y + buttonFrame.size.height - kFilterProIconHeight-kFilterFrameThickness,
kFilterProIconWidth,
kFilterProIconHeight);
[proTag setBackgroundColor:[UIColor orangeColor]];
[proTag setFrame:proFrame];
[thumbnailButton addSubview:proTag];
[self.filterProTags addObject:proTag];
}
}
}
Selector Method:
-(void)filterSelected:(UIButton *)button
{
NSLog(#"Pressed button for index %i",button.tag);
int buttonTag = button.tag;
if ((buttonTag < kFilterProMinimumIndex+1) || ([self isProVersion] == YES)){
[self.imageView setImage:[self applyFilterAtIndex:buttonTag ToImage:self.workingImage]];
}
else {
[self processProPurchaseAfterAlert];
}
}
I see a couple issues in this, but I'm not sure which ones are causing it to break. First, you should instantiate your button using buttonWithType: on UIButton:
UIButton *thumbnailButton = [UIButton buttonWithType:UIButtonTypeCustom];
[thumbnailButton setFrame:buttonFrame]
The reason for this is UIButton is a class cluster, and you should let the OS give you the correct button.
Secondly, you're adding the Button as a Subview of an UIImageView, which by default, has userInteractionEnabled set to NO.
This property is inherited from the UIView parent class. This class
changes the default value of this property to NO.
You should have the button be one large button, with the background of the button be the image you want it to be.

Custom UIView on iPhone, should look like UIPopover

my goal is to create a simple popover view over a bar button in my tool bar. So apparently Apple doesn't want me to create this on my iPhone. But i already saw something familiar on other apps.
So instead of using the UIPopOver thing from Apple, i like to create an UIView which appears when the bar button is clicked. And disappears when it is clicked again. It would be over the top if i also could create the little arrow which points to the button (you know which arrow i mean :D). But this is not relevant at this time. I just want to create this "popover appears and disappears with the same button". My "solution" right know is not a solution:
- (IBAction)buttonPressed:(id)sender
{
UIView *myPopOverView = [[UIView alloc] initWithFrame:CGRectMake(25, 25, 500, 250)];
myPopOverView.alpha = 0.0;
myPopOverView.layer.cornerRadius = 5;
myPopOverView.layer.borderWidth = 1.5f;
myPopOverView.layer.masksToBounds = YES;
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:#selector(testNSLog)
forControlEvents:UIControlEventTouchUpInside];
[button setTitle:#"Show myPopOverView" forState:UIControlStateNormal];
button.frame = CGRectMake(10, 10, 100, 30);
[myPopOverView addSubview:button];
[self.view addSubview:myPopOverView];
[UIView animateWithDuration:0.4 animations:^{
[myPopOverView setAlpha:1.0];
} completion:^(BOOL finished) {}];
}
So i don't have a clue on how to do that with this code fragment. It appears right away as i want. But i don't know how to create this toggle. I tried with a simple Bool-If-Toggle, but it didn't work. And i don't really know how to remove it from my view either.
Can you guys help me with this?
Thanks in advance!
Ok i solved it.
i defined a UIView in the .h-File and instantiate it in ViewDidLoad, then i did:
- (IBAction)buttonPressed:(id)sender
{
if (showedOptions == NO) {
[self.view addSubview:self.popoverView];
[UIView animateWithDuration:0.4 animations:^{
[self.popoverView setAlpha:1.0];
} completion:^(BOOL finished) {}];
showedOptions = YES;
return;
} else {
showedOptions = NO;
[self.popoverView removeFromSuperview];
}
}

Resources