对不起,我是一名新手。这是否会释放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