类似于Pinterest的上下文菜单iOS控件:GHContextMenu

jopen 11年前

GHContextMenu就一个类似于Pinterest的上下文菜单iOS控件。

// Creating      GHContextMenuView* overlay = [[GHContextMenuView alloc] init];      overlay.dataSource = self;      overlay.delegate = self;        UILongPressGestureRecognizer* _longPressRecognizer = [[UILongPressGestureRecognizer alloc] initWithTarget:overlay action:@selector(longPressDetected:)];      [self.view addGestureRecognizer:_longPressRecognizer];    // Implementing data source methods  - (NSInteger) numberOfMenuItems  {      return 3;  }    -(UIImage*) imageForItemAtIndex:(NSInteger)index  {      NSString* imageName = nil;      switch (index) {          case 0:              imageName = @"非死book";              break;          case 1:              imageName = @"推ter";              break;          case 2:              imageName = @"google-plus";              break;            default:              break;      }      return [UIImage imageNamed:imageName];  }    - (void) didSelectItemAtIndex:(NSInteger)selectedIndex forMenuAtPoint:(CGPoint)point  {      NSString* msg = nil;      switch (selectedIndex) {          case 0:              msg = @"非死book Selected";              break;          case 1:              msg = @"推ter Selected";              break;          case 2:              msg = @"Google Plus Selected";              break;            default:              break;      }        UIAlertView* alertView = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];      [alertView show];    }

类似于Pinterest的上下文菜单iOS控件:GHContextMenuBackgroundImageBackgroundImage

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