类似POPView菜单

-(void)btnClick:(UIButton *)button{
    if (self.btnStatus == YES) {
        [self.btn setImage:self.btnImageOff forState:UIControlStateNormal];
        [self addFenleiController];
        _fenleiController.view.hidden=NO;
    }
    else{
        [self.btn setImage:self.btnImageOn forState:UIControlStateNormal];
        
        _fenleiController.view.hidden = YES;
    }
    self.btnStatus = !self.btnStatus;
 
}
-(void)addFenleiController{
    _fenleiController =[[FenleiViewController alloc]init];
    _fenleiController.view.backgroundColor=[UIColor whiteColor];
    _fenleiController.view.frame =CGRectMake(0, 105, self.view.frame.size.width, 300);
    [_fenleiController willMoveToParentViewController:self];
    [self addChildViewController:_fenleiController];
    [self.view addSubview:_fenleiController.view];
    [_fenleiController didMoveToParentViewController:self];
    float length =(_fenleiController.view.frame.size.width-10)/4;
    NSArray *arr =@[@"巧手搭配",@"趣致创意",@"收纳控",@"食色",@"绿植",@"萌宠",@"生活杂事",@"DIY",@"相夫教子",@"别人的生活",@"洗刷刷",@"晒物",@"求助&经验"];
    for (int i=0; i<4; i++) {
        for (int j=0;j<4 ; j++) {
            UIButton *button=[UIButton buttonWithType:UIButtonTypeSystem];
            button.frame=CGRectMake(j*length+10, i*50+30, length-10, 30);
            button.backgroundColor =[UIColor groupTableViewBackgroundColor];
            [button setTitle:arr[i*4+j] forState:UIControlStateNormal];
            [button addTarget:self action:@selector(buttonClick1:) forControlEvents:UIControlEventTouchUpInside];
            button.tag =101+(i*4+j+2);
            [_fenleiController.view addSubview:button];
            if (j==0&&i==3) {
                
                return;
            }
        }
    }
}

阅读更多
个人分类: iOS开发
上一篇UIView 页面跳转动画
下一篇NSURL 中的HTTP 中文乱码
想对作者说点什么? 我来说一句

iOS 类似alertView的弹窗popview

2016年03月01日 192KB 下载

fzAndroidMap

2012年05月28日 269KB 下载

没有更多推荐了,返回首页

关闭
关闭