Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

General Discussion

how to fix my UI button which freezes when I tap it?

Im using Xcode 5.0.2. Any help would truly be appreciated here's my code.

'''iOS'''

- (IBAction)btnMenuTapped:(id)sender
{
    if (self.popoverController)
    {
        [self.popoverController dismissPopoverAnimated:YES];
        self.popoverController = nil;
    }
    else
    {
        MainMenuViewController *contentViewController = [[MainMenuViewController alloc] initWithNibName:@"MainMenuViewController" bundle:nil];
        contentViewController.delegate = self;
        self.popoverController = [[WEPopoverController alloc] initWithContentViewController:contentViewController];
        self.popoverController.delegate = self;
        self.popoverController.popoverContentSize = contentViewController.view.frame.size;

        [self.popoverController presentPopoverFromRect:[sender frame]
                                                inView:self.view
                              permittedArrowDirections:UIPopoverArrowDirectionDown
                                              animated:YES];

    }
}

@interface MainViewController : UIViewController <LoginDelegate,WEPopoverParentView,PopoverControllerDelegate,MainMenuDelegate,MKMapViewDelegate,UIActionSheetDelegate,UIAccelerometerDelegate, CLLocationManagerDelegate, NSObject>
{
    AppDelegate *appDelegate;
    IBOutlet MKMapView *userMap;
    CLLocationManager *locationManager;

}
@property (strong, nonatomic) IBOutlet UILabel *speedView;
@property(nonatomic) int speedCount;
@property (nonatomic,retain) CLLocationManager *locationManager;
@property (nonatomic, strong) WEPopoverController *popoverController;

+ (NSString *) speedToMPH: (float) value;


- (IBAction)btnMenuTapped:(id)sender;

@end

But this line of code is where my app freezes

self.popoverController.popoverContentSize = contentViewController.view.frame.size;

and this is what I get in the debug area

self MainViewController * 0x1656d100 0x1656d100 contentViewController MainMenuViewController * 0x1864eef0 0x1864eef0