给UIColor写一个延展:
#import
@interface UIColor (color)
+ (UIColor*)colorWithHexString:(NSString*)hex;
+ (UIColor*)colorWithHexString:(NSString*)hex withAlpha:(CGFloat)alpha;
...
分类:
移动开发 时间:
2015-04-16 17:47:49
阅读次数:
126
1、改变高度
自定义UINavigationBar的新类别:
[cpp] view
plaincopy
//UINavigationBar+BackgoundImage.h
#import
@interface UINavigationBar (BackgoundImage)
@end
在新类别的实...
分类:
移动开发 时间:
2015-04-16 17:47:46
阅读次数:
133
本系列的第一篇文章介绍了自动布局的基本原理,第二篇文章通过一个简单的例子演示了如何使用Xcode的Interface Builder(简称IB)以可视化方式添加约束。本篇为该系列的第三篇文章,主要介绍如何通过代码来添加布局约束。...
分类:
移动开发 时间:
2015-04-16 17:47:10
阅读次数:
219
我们知道数组对象可以使用foreach迭代进行遍历,同时我们发现类ArrayList和List也可以使用foreach进行迭代。如果我们自己编写的类也需要使用foreach进行迭代时该怎么办呢?IEnumerable:1 public interface IEnumerable2 {3 IE...
分类:
编程语言 时间:
2015-04-16 14:02:11
阅读次数:
205
.h#import @interface ZHCustomImageView : UIView//提供接口@property (nonatomic, strong) UIImage* image;- (instancetype)initWithImage:(UIImage*)image;@end.m...
分类:
其他好文 时间:
2015-04-16 13:59:35
阅读次数:
140
通过@dynamic和objc_setAssociatedObject,实现给类别添加属性,前者是说明程序员自己实现setter和getter,后者是动态给对象添加属性。两个配合使用可以实现给对象添加属性。下面代码以scrollview为例:
头文件
@interface UIScrollView (Refresh)
@property (nonatomic) RefreshView * refreshView;
@end
源文件
#import
static cha...
分类:
其他好文 时间:
2015-04-16 10:23:03
阅读次数:
648
目的:减少依赖 设计模式对应不同的需求,设计原则则代表永恒的灵魂,在实践中未必时刻遵守,但要时刻牢记。 1、依赖倒转原则(Dependence Inversion Principle) 2、接口隔离原则(Interface Segregation Principle) 3、里氏代换原则(L...
分类:
其他好文 时间:
2015-04-16 06:39:12
阅读次数:
142
做一个课堂练习,单个view的登陆窗口,一直很顺利,突然编译运行出错,所有的空间不显示。查了很久,又问了培训的老师才搞定,特此记录解决办法。Unknown class in InterfaceBuilder file.现象:link报错, Unknown class in Interface B.....
分类:
其他好文 时间:
2015-04-16 01:26:41
阅读次数:
134
在运行service network restart命令时候,显示如下错误hutting down loopback interface: [ OK ]Bringing up loopback interface: ...
分类:
Web程序 时间:
2015-04-16 01:00:43
阅读次数:
402
“@Override is not allowed when implementing interface method”错误的解决办法 由于使用的Java IDE是IntelliJ,并且遇到了这个错误提示,那么可能是项目属性设置不对导致的,试试: 在菜单“File”→“Proje...
分类:
编程语言 时间:
2015-04-15 23:51:50
阅读次数:
313