0

我在我的应用程序中使用侧边栏菜单,就像在 facebook 中一样,所以我在这个菜单中有不同的单元格,我想要的是当单击一个单元格时将我推到另一个视图控制器。我正在使用此代码。请给我任何想法

视图控制器.m

- (IBAction)onBurger:(id)sender 

{

 NSArray *images = @[

[UIImage imageNamed:@"gear"],

[UIImage imageNamed:@"globe"],

[UIImage imageNamed:@"profile"],

[UIImage imageNamed:@"star"],

[UIImage imageNamed:@"gear"],

[UIImage imageNamed:@"globe"],

[UIImage imageNamed:@"profile"],

[UIImage imageNamed:@"star"],

[UIImage imageNamed:@"gear"],

[UIImage imageNamed:@"globe"],

[UIImage imageNamed:@"profile"],

[UIImage imageNamed:@"star"],

];

NSArray *colors = @[

[UIColor colorWithRed:240/255.f green:159/255.f blue:254/255.f alpha:1],

[UIColor colorWithRed:255/255.f green:137/255.f blue:167/255.f alpha:1],

[UIColor colorWithRed:126/255.f green:242/255.f blue:195/255.f alpha:1],

[UIColor colorWithRed:119/255.f green:152/255.f blue:255/255.f alpha:1],

[UIColor colorWithRed:240/255.f green:159/255.f blue:254/255.f alpha:1],

[UIColor colorWithRed:255/255.f green:137/255.f blue:167/255.f alpha:1],

[UIColor colorWithRed:126/255.f green:242/255.f blue:195/255.f alpha:1],

[UIColor colorWithRed:119/255.f green:152/255.f blue:255/255.f alpha:1],

[UIColor colorWithRed:240/255.f green:159/255.f blue:254/255.f alpha:1],

[UIColor colorWithRed:255/255.f green:137/255.f blue:167/255.f alpha:1],

[UIColor colorWithRed:126/255.f green:242/255.f blue:195/255.f alpha:1],

[UIColor colorWithRed:119/255.f green:152/255.f blue:255/255.f alpha:1],
                        ];

    RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithImages:images selectedIndices:self.optionIndices borderColors:colors];

//    RNFrostedSidebar *callout = [[RNFrostedSidebar alloc] initWithImages:images];

callout.delegate = self;

//    callout.showFromRight = YES;

[callout show];

}

#pragma mark - RNFrostedSidebarDelegate

- (void)sidebar:(RNFrostedSidebar *)sidebar didTapItemAtIndex:(NSUInteger)index 
{

 NSLog(@"Tapped item at index %i",index);

if (index == 3) 

{

[sidebar dismiss];

}

else if(index==2)

{

[sidebar dismiss];

 }


else if(index==1)

{

[sidebar dismiss];

}

 else if(index==0)

{

[sidebar dismiss];

}

}

- (void)sidebar:(RNFrostedSidebar *)sidebar didEnable:(BOOL)itemEnabled itemAtIndex:(NSUInteger)index 

{

if (itemEnabled) 

{

[self.optionIndices addIndex:index];

 }

else 

{

[self.optionIndices removeIndex:index];

}

}
4