我在做像iOS的滑動菜單像一個簡單的應用程序我在哪裏做一步一步的過程從這個鏈接可用的教程http://www.raywenderlich.com/32054/how-to-create-a-slide-out-navigation-like-facebook-and-path 。我只是在做正確的面板滑動,當我點擊按鈕將其移動滑塊發生,但是當我再次撥打我的主要觀點正在發生,但應用越來越崩潰可以在任何一個可以幫助我從這個問題應用崩潰在做幻燈片菜單在ios
#define RIGHT_PANEL 2
#define CENTRAL_TAG 1
#define SLIDE_TIMING .25
#define PANEL_WIDTH 60
@interface MainViewController()<CenterViewControllerDelegate>
@property(nonatomic,strong)CentralViewController *centralView;
@property(nonatomic,strong)RightViewController *RightView;
@property (nonatomic, assign) BOOL showingRightPanel;
-(UIView*)getright;
-(UIView*)resetmainView;
@end
@implementation MainViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.centralView = [[CentralViewController alloc] initWithNibName:@"CentralViewController" bundle:nil];
self.centralView.view.tag = CENTRAL_TAG;
self.centralView.delegate=self;
[self.view addSubview:self.centralView.view];
[self addChildViewController:_centralView];
[_centralView didMoveToParentViewController:self];
}
-(UIView*)getright
{
if(_RightView==Nil)
{
self.RightView=[[RightViewController alloc]initWithNibName:@"RightViewController" bundle:Nil];
self.RightView.view.tag=RIGHT_PANEL;
self.RightView.delegate=self;
[self.view addSubview:self.RightView.view];
[self addChildViewController:self.RightView];
[_RightView didMoveToParentViewController:self];
_RightView.view.frame=CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}
self.showingRightPanel=YES;
UIView *view=self.RightView.view;
return view;
}
-(void)MovetoOriginal
{
[UIView animateWithDuration:SLIDE_TIMING delay:0 options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
_centralView.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
}
completion:^(BOOL finished) {
if (finished) {
[self resetmainView];
}
}];}
-(void)rightpanelmove
{
UIView *child=[self getright];
[self.view sendSubviewToBack:child];
[UIView animateWithDuration:SLIDE_TIMING delay:0 options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
_centralView.view.frame = CGRectMake(-self.view.frame.size.width + PANEL_WIDTH, 0, self.view.frame.size.width, self.view.frame.size.height);
}
completion:^(BOOL finished) {
if (finished) {
_centralView.rightbutton.tag = 1;
}
}];
}
-(UIView*)resetmainView
{
if(_RightView!=Nil)
{
[self.RightView.view removeFromSuperview];
self.RightView=Nil;
_centralView.rightbutton.tag=0;
self.showingRightPanel=NO;
}
這是出不來我主要的控制代碼,其中我打電話時
而這一次按鈕操作代碼
- (IBAction)btnright:(id)sender {
UIButton *button = sender;
switch (button.tag) {
case 0: {
[_delegate rightpanelmove];
break;
}
case 1: {
[_delegate MovetoOriginal];
break;
}
default:
break;
}}
這裏打印您的崩潰日誌:) – Rushabh
崩潰意味着它顯示線[自resetmainView]線程錯誤和其功能 –
請與我們分享您的錯誤信息。在控制檯上出現的全部信息。編輯您的問題,以使其可讀。 –