RPSlidingMenu 1.0.3

RPSlidingMenu 1.0.3

测试已测试
语言语言 Obj-CObjective C
许可协议 MIT
发布最新发布2014年12月

Paul Thorsteinson维护。



  • Paul Thorsteinson

一款类似于UltraVisual风格的集合视图菜单。

RPSlidingMenu animated GIF

YouTube视频

安装

使用方法

(请查看/Demo中的示例Xcode项目)

创建一个继承自RPSlidingMenuViewController的新文件

重写以下方法

// return the number of menu items
- (NSInteger)numberOfItemsInSlidingMenu;
// set properties of the cell like the textLabel.text, detailLabel.text and backgroundImageView.image
- (void)customizeCell:(RPSlidingMenuCell *)slidingMenuCell forRow:(NSInteger)row;
// optionally to handle a menu item being tapped
- (void)slidingMenu:(RPSlidingMenuViewController *)slidingMenu didSelectItemAtRow:(NSInteger)row;

.m中的代码示例

- (NSInteger)numberOfItemsInSlidingMenu {
    return 10; // 10 menu items
}

- (void)customizeCell:(RPSlidingMenuCell *)slidingMenuCell forRow:(NSInteger)row {
    slidingMenuCell.textLabel.text = @"Some Title";
    slidingMenuCell.detailTextLabel.text = @"Some longer description that is like a subtitle!";
    slidingMenuCell.backgroundImageView.image = [UIImage imageNamed:@"some_image"];

}

- (void)slidingMenu:(RPSlidingMenuViewController *)slidingMenu didSelectItemAtRow:(NSInteger)row {
    // when a row is tapped do some action like go to another view controller
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Row Tapped"
                                                    message:[NSString stringWithFormat:@"Row %d tapped.", row]
                                                   delegate:nil
                                          cancelButtonTitle:@"OK"
                                          otherButtonTitles:nil];
    [alert show];
}

注意

  • 在演示中,我使用了320x210的图片。关键是图片需要足够大,以覆盖单元的大小。

联系

Robots & Pencils Logo

在Twitter上关注Robot & Pencils (@robotsNpencils)

维护者

许可协议

RPSlidingMenu遵循MIT许可协议。有关更多信息,请参阅LICENSE文件。