隐藏指定的UIView区域
2015-06-20 22:35
417 查看
1.说明
使用UIView的属性hidden隐藏指定的区域,属性hidden值为YES时隐藏UIView,属性hidden值为NO时显示UIView2.实例
起:点击按钮终:实现文本隐藏和文本显示切换
.h
#import <UIKit/UIKit.h>
@interface UIKitPrjFrame : UIViewController {
@private
UILabel * _label;
}
@end
.m
#import "UIKitPrjFrame.h"
@interface UIKitPrjFrame ()
@end
@implementation UIKitPrjFrame
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.view.backgroundColor = [UIColor blackColor];
_label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 320, 200)];
_label.textAlignment = NSTextAlignmentCenter;
_label.backgroundColor = [UIColor blackColor];
_label.textColor = [UIColor whiteColor];
_label.text = @"Im' here";
[self.view addSubview:_label];
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
button.frame = CGRectMake(0, 0, 100, 40);
CGPoint newPoint = self.view.center;
newPoint.y = self.view.frame.size.height - 70;
button.center = newPoint;
[button setTitle:@"点击" forState:UIControlStateNormal];
[button addTarget:self action:@selector(buttonDidPush) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:button];
}
- (void)buttonDidPush {
_label.hidden = !_label.hidden;
}
相关文章推荐
- 自己实现基于key-value的NoSQL数据库(三)—— B+树和Hash算法
- @requestparam怎么用
- 机房重构--UI设计与单例思考
- Java并发编程-31-阻塞式优先级列表-PriorityBlockingQueue
- hdu 5273 Dylans loves sequence
- HDU 5273 Dylans loves sequence(区间DP)
- UISegmentedControl的详细使用
- hdu 5273 Dylans loves sequence
- UVa1152 - 4 Values whose Sum is 0(hash)
- UVa1605 - Building for UN(构造)
- GitLab:解决Merge Request中Commits不更新的问题
- ABP 初探 之基于EasyUI的CURD
- Ubuntu12.04配置vnc远程桌面,解决Could not acquire name on session bus问题
- hdu 5273 Dylans loves sequence 逆序数简单递推
- 11gR2 OUI安装界面的System Class和 Desktop Class
- Java-马士兵设计模式学习笔记-责任链模式-模拟处理Reques Response
- Java并发编程-30-阻塞式线程安全列表-LinkedBlockingDeque
- ubuntu 12.04下配置单机pbs(torque)
- 自己实现基于key-value的NoSQL数据库(二)—— 改进存储方式和查询修改函数
- [原创]UUID的介绍和使用