实现 Tumblr 应用的弹出菜单的方式:TumblrLikeMenu

jopen 11年前

TumblrLikeMenu 使用CAAnimation 实现 Tumblr 应用的弹出菜单的方式。

首先,设置子菜单:

TumblrLikeMenuItem *menuItem0 = [[TumblrLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"推ter"]                                                           highlightedImage:[UIImage imageNamed:@"推ter"]                                                                       text:@"推ter"];  TumblrLikeMenuItem *menuItem1 = [[TumblrLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"非死book"]                                                           highlightedImage:[UIImage imageNamed:@"非死book"]                                                                       text:@"非死book"];  TumblrLikeMenuItem *menuItem2 = [[TumblrLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"油Tube"]                                                           highlightedImage:[UIImage imageNamed:@"油Tube"]                                                                       text:@"油Tube"];  TumblrLikeMenuItem *menuItem3 = [[TumblrLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"Google+"]                                                           highlightedImage:[UIImage imageNamed:@"Google+"]                                                                       text:@"Google+"];  TumblrLikeMenuItem *menuItem4 = [[TumblrLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"Tumblr"]                                                           highlightedImage:[UIImage imageNamed:@"Tumblr"]                                                                       text:@"Tumblr"];  TumblrLikeMenuItem *menuItem5 = [[TumblrLikeMenuItem alloc] initWithImage:[UIImage imageNamed:@"LinkedIn"]                                                           highlightedImage:[UIImage imageNamed:@"LinkedIn"]                                                                       text:@"LinkedIn"];    NSArray *subMenus = @[menuItem0, menuItem1, menuItem2, menuItem3, menuItem4, menuItem5];

第二步创建菜单:

TumblrLikeMenu *menu = [[TumblrLikeMenu alloc] initWithFrame:self.view.bounds                                                      subMenus:subMenus                                                           tip:@"Nevermind"];  menu.selectBlock = ^(NSUInteger index) {      NSLog(@"item %ld index selected", index);  };
最后显示:
[menu show];

 实现 Tumblr 应用的弹出菜单的方式:TumblrLikeMenu

项目主页:http://www.open-open.com/lib/view/home/1389340456867