對不起,我是一名新手。這是否會釋放OverlayviewController?因爲它是autorelease並在dealloc上再次發佈。或者沒關係?感謝您的幫助。過度釋放或沒有?
@implementation ViewController
@synthesize imageView, overlayViewController, cameraBtn;
#pragma mark -
#pragma mark View Controller
- (void)viewDidLoad
{
[super viewDidLoad];
// Sharekit Logout button
self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:SHKLocalizedString(@"Logout") style:UIBarButtonItemStyleBordered target:self action:@selector(logout)] autorelease];
self.overlayViewController =
[[[OverlayViewController alloc] initWithNibName:@"OverlayViewController" bundle:nil] autorelease];
// as a delegate we will be notified when pictures are taken and when to dismiss the image picker
self.overlayViewController.delegate = self;
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
cameraBtn.hidden = YES;
}
}
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
- (void)viewDidUnload
{
self.imageView = nil;
self.overlayViewController = nil;
}
- (void)dealloc
{
[imageView release];
[overlayViewController release];
[super dealloc];
}
非常感謝您詳細的解答。屬性的overlayViewController確實有在頭部聲明的保留選項。所以我覺得這是好的。不是問題爲什麼蘋果拒絕了應用程序將不得不看看其他地方... – Clasher 2011-04-30 08:36:52
@Clasher:只是好奇:Apple gav是什麼原因e拒絕? – DarkDust 2011-04-30 08:44:25
他們說,啓動時,應用程序崩潰,按任何按鈕......我不能在這裏重現。一直在尋找幾個星期...仍然無法解決。這是第二次被拒絕。我已經在這裏發佈了崩潰報告,但目前爲止沒有答案。 http://stackoverflow.com/questions/5836769/app-store-crash-report。如果您願意提供幫助,我可以向您發送完整的代碼。這讓我瘋狂。再次感謝! – Clasher 2011-04-30 08:56:26