Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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.


- (IBAction)btnMenuTapped:(id)sender
    if (self.popoverController)
        [self.popoverController dismissPopoverAnimated:YES];
        self.popoverController = nil;
        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]


@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;


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