简单图片浏览器

在设置开关灯的时候出了一点小问题,默认UISwitch为on当用if(sender.on)做判断时,第一次点击无效。后来调试默认为on,当改变状态时sender.on返回的是0,再次点击返回的是1。判断一个UISwitch为off可以用!sender.on

用到加载本地目录下的文件

    //获取所有描述(通过解析plist文件来创建数组对象,比如传入文件的全路径)
    NSBundle *bundle = [NSBundle mainBundle];
    //获取文件的全路径
    NSString *path = [bundle pathForResource:@"descs" ofType:@"plist"];

 显示隐藏"菜单"

[UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    CGRect _rect = _attrView.frame;
    //判断如果是隐藏则显示,如果是显示则隐藏
    if (_rect.origin.y == self.view.frame.size.height - _attrView.frame.size.height) {
         //设置隐藏
        _rect.origin.y = self.view.frame.size.height;
    }else{
        _rect.origin.y = self.view.frame.size.height - _attrView.frame.size.height;
    }
    _attrView.frame = _rect;
    [UIView commitAnimations];

 最好是用bound属性,不过这个地方用frame属性也可以实现相同的效果

posted @ 2014-08-21 21:33  yjjqtd  阅读(165)  评论(0编辑  收藏  举报