简单图片浏览器
在設(shè)置開關(guān)燈的時候出了一點小問題,默認(rèn)UISwitch為on當(dāng)用if(sender.on)做判斷時,第一次點擊無效。后來調(diào)試默認(rèn)為on,當(dāng)改變狀態(tài)時sender.on返回的是0,再次點擊返回的是1。判斷一個UISwitch為off可以用!sender.on
用到加載本地目錄下的文件
//獲取所有描述(通過解析plist文件來創(chuàng)建數(shù)組對象,比如傳入文件的全路徑)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) {//設(shè)置隱藏_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屬性也可以實現(xiàn)相同的效果
轉(zhuǎn)載于:https://www.cnblogs.com/qifeng/p/3928132.html
總結(jié)
- 上一篇: 三国轶事——巴蜀之危
- 下一篇: Hdu1166单点更新线段树