무슨 일이 일어나는지 알 수는 없지만 사용자가 버튼을 선택할 때 하위보기를 표시하는보기가 있습니다. 이 하위 뷰에는 사용자가이 하위 뷰를 취소하고 제거 할 수있는 버튼이 있습니다. 이 모든 일이 발생하면 하위보기를 닫으려고 할 때 내 응용 프로그램이 충돌합니다.iPhone iOS 6 - 하위보기를 닫을 때 충돌이 발생합니다.
이 내 코드입니다 : 버튼을 선택하면 하위 뷰를 보여 주보기에서
- 이것은 단순히 새로운 서브 뷰를 보여줍니다 당신이 볼 수 있듯이
-(IBAction)sendMessage:(id)sender{
NSLog(@"Going to send a message....");
CGRect frameBounds = [self.view bounds];
float frameWidth = frameBounds.size.width;
float frameHeight = frameBounds.size.height;
float frameX = frameBounds.origin.x;
//float frameY = frameBounds.size.height/2;
float frameY = frameBounds.size.height;
float finalY = frameBounds.size.height/1.75;
MessageChooserController *chooser = [[MessageChooserController alloc] initWithNibName:@"MessageChooser" bundle:nil];
//Set the frame off the screen at the bottom
chooser.view.frame = CGRectMake(frameX, frameY, frameWidth, frameHeight);
[self.view addSubview:chooser.view];
[UIView animateWithDuration:0.5 animations:^{chooser.view.frame = CGRectMake(frameX, finalY, frameWidth, frameHeight);}];
}
- MessageChooserController. 이제이 서브 뷰인 MessageChooserController는이 "액션"을 취소하는 버튼을 가지고 있습니다.
MessageChooserController의 헤더 파일 :
#import <UIKit/UIKit.h>
@interface MessageChooserController : UIViewController
@property (weak, nonatomic) IBOutlet UIButton *btn_sendEmail;
@property (weak, nonatomic) IBOutlet UIButton *btn_sendText;
@property (weak, nonatomic) IBOutlet UIButton *btn_cancel;
-(IBAction)closeChooser:(id)sender;
@end
및 구현 :
#import "MessageChooserController.h"
@interface MessageChooserController()
@end
@implementation MessageChooserController
@synthesize btn_cancel, btn_sendEmail, btn_sendText;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view.
/*
[btn_cancel setBackgroundImage:[[UIImage imageNamed:@"iphone_delete_button.png"] stretchableImageWithLeftCapWidth:8.0f topCapHeight:0.0f] forState:UIControlStateNormal];
*/
/*
UIImage *cancelButtonImage = [[UIImage imageNamed:@"iphone_delete_button"] resizableImageWithCapInsets:UIEdgeInsetsMake(30,0,30,0)resizingMode:UIImageResizingModeStretch];
[btn_cancel setBackgroundImage:cancelButtonImage forState:UIControlStateNormal];
*/
}
-(IBAction)closeChooser:(id)sender{
[self.view removeFromSuperview];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
당신은 내가, closeChooser을이 서브 뷰를 닫습니다 간단한 방법을 볼 수 있듯이. 이 모든 컴파일하지만 하위보기에서 취소 단추를 선택하면 내 응용 프로그램이 충돌합니다. 나는 이것에 대해 아무 것도 찾을 수 없다.
기본적으로 연락처에서 "메시지 보내기"를 선택할 때와 같은보기 디스플레이가 필요합니다.
충돌 로그를 보는 것이 도움이됩니다. – Abizern
어떻게 충돌 로그를 가져 오나요? – CodeMoto
Xcode 콘솔에 있습니다. – Abizern