今天学点category

  • 给定字符串 变化颜色 #import "UIColor+MALColor.h"
self.view.backgroundColor = [UIColor colorWithHex:@"#975d91"];

  • 知道我们当前在哪个ViewController #import "NSObject+SystemInfo.h"
        UINavigationController *vc = [NSObject  getCurrentVC];        
  • 这个方法是hom建走的方法 回到桌面
      - (void)applicationDidEnterBackground:(UIApplication *)application {
    

}

* 这个方法是从桌面回到当前页面
- (void)applicationWillEnterForeground:(UIApplication *)application {   

}

* 改变任意控件的大小位置 只改变一项 ``#import "UIView+MALFrame.h"
* 定义一个float变量 ``float f = 53;``
* 自定义一个控件  

UIButton *btn = [[UIButton alloc] init];
btn.backgroundColor = [UIColor blueColor];
btn.frame = CGRectMake(123, 123, width, f);
[btn addTarget:self action:@selector(click:) forControlEvents:UIControlEventAllEvents];
[self.view addSubview:btn];

* 在点击事件中写点击是怎么改变

-(void)click:(UIButton *)btn{

width +=1;
[btn setViewWidth:width];

}


 
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容