如何在iphone中将侧栏菜单推送到另一个viewController
我在我的应用程序中使用侧栏菜单,就像在facebook中一样,所以我在这个菜单中有不同的单元格,我想要的是当点击一个单元格时,将我推到另一个视图控制器。我正在使用这个代码。请告诉我一些想法 Viewcontroller.m如何在iphone中将侧栏菜单推送到另一个viewController,iphone,ios,objective-c,xcode,Iphone,Ios,Objective C,Xcode,我在我的应用程序中使用侧栏菜单,就像在facebook中一样,所以我在这个菜单中有不同的单元格,我想要的是当点击一个单元格时,将我推到另一个视图控制器。我正在使用这个代码。请告诉我一些想法 Viewcontroller.m - (IBAction)onBurger:(id)sender { NSArray *images = @[ [UIImage imageNamed:@"gear"], [UIImage imageNamed:@"globe"], [UIImage imageN
- (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];
}
}
试试这个,我用过这个,效果很好。
像我们在正常情况下那样,在推送任何带有导航功能的viewController时会发生什么?如果还没有尝试过,那么尝试一下,让我们知道会发生什么。