Skip to content

sagiwei/SGPopSelectView

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SGPopSelectVIew

一个简洁、美观的单选弹出视图

demo

特点

  • 自适应选项内容调整自身大小,不用担心选项标题过长被截断显示。
  • 根据传入基准点自适应在父试图中显示的位置。

用法

初始化

    self.selections = @[@"Shake It Off",@"All About that Bass",@"Animals",@"Take Me To Church",@"Out Of The Woods",@"Centuries",@"I'm Not the Only One",@"Burnin' It Down"];
    self.popView = [[SGPopSelectView alloc] init];
    self.popView.selections = self.selections;
    __weak typeof(self) weakSelf = self;
    self.popView.selectedHandle = ^(NSInteger selectedIndex){
        NSLog(@"selected index %ld, content is %@", selectedIndex, weakSelf.selections[selectedIndex]);
    };

显示

    CGPoint p = [(UIButton *)sender center];
    [self.popView showFromView:self.view atPoint:p animated:YES];

隐藏

    [self.popView hide:YES];