Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- missing UITapGestureRecognizer addTarget retain?!
- *** -[Test tapDetected:]: message sent to deallocated instance 0x113de4d0
- **/
- // FirstViewController.h
- #import <UIKit/UIKit.h>
- #import "Test.h"
- @interface FirstViewController : UIViewController
- @property (strong, nonatomic) NSMutableArray *meinTest;
- @property (strong, nonatomic) Test *meinTest2;
- @end
- ### ### ### ### ### ### ### ### ###
- // FirstViewController.m
- #import "FirstViewController.h"
- @implementation FirstViewController
- @synthesize meinTest;
- @synthesize meinTest2;
- - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
- {
- self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
- if (self) {
- self.title = NSLocalizedString(@"First", @"First");
- self.tabBarItem.image = [UIImage imageNamed:@"first"];
- self.meinTest = [[NSMutableArray alloc] init];
- self.meinTest2 = [[Test alloc] init];
- }
- return self;
- }
- - (void)didReceiveMemoryWarning
- {
- [super didReceiveMemoryWarning];
- // Release any cached data, images, etc that aren't in use.
- }
- #pragma mark - View lifecycle
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // NO CRASH
- //Test *test = [[Test alloc] init];
- //[self.meinTest addObject:test];
- //UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:test action:@selector(tapDetected:)];
- //[self.view addGestureRecognizer:tap];
- // NO CRASH
- //UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self.meinTest2 action:@selector(tapDetected:)];
- //[self.view addGestureRecognizer:tap2];
- // CRASH
- //Test *test = [[Test alloc] init];
- //UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:test action:@selector(tapDetected:)];
- //[self.view addGestureRecognizer:tap];
- }
- - (void)viewDidUnload
- {
- [super viewDidUnload];
- // Release any retained subviews of the main view.
- // e.g. self.myOutlet = nil;
- }
- - (void)viewWillAppear:(BOOL)animated
- {
- [super viewWillAppear:animated];
- }
- - (void)viewDidAppear:(BOOL)animated
- {
- [super viewDidAppear:animated];
- }
- - (void)viewWillDisappear:(BOOL)animated
- {
- [super viewWillDisappear:animated];
- }
- - (void)viewDidDisappear:(BOOL)animated
- {
- [super viewDidDisappear:animated];
- }
- - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
- {
- // Return YES for supported orientations
- if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
- return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
- } else {
- return YES;
- }
- }
- @end
Add Comment
Please, Sign In to add comment