- 博客(12)
- 收藏
- 关注
原创 Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified
Xcode报警告⚠:Pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified的时候,给方法加参数和给block加参数使用的关键字写法是不同的。 nullable,__nullable,_Nullable。- (nullable UIAlertController *)yesO
2016-04-01 21:19:33
2534
原创 Iphone中的UIPopoverController
前言UIPopoverController这个东西在9.0之后就只属于Ipad了,取而代之的是使用UIModalPresentationPopover 。下面以Storyboard的形式实现Iphone中UIModalPresentationPopover的使用。环境Xcode: Ver7.2.1 IOS:9.2效果图Storyboard设定代码- (IBAction)popoverButton
2016-04-01 14:32:45
2019
原创 快速排序
前言这两天突然看到快速排序四个字,已经记不起来快速排序是怎么排了,所以在这里纪录一下自己的想法。理解错误的地方请指出!思想以升序为例,首先寻找一个[基准数],然后把比[基准数]小的都放在左边,比[基准数]大的都放在右边。划分好堆儿以后,再分别对两堆儿的数字进行划分,直到不能再划分为止,数组变得有序。总体流程例如对数组 {7,3,2,6,4,1,5,8,9} 进行快速排序。①选择一个基准数。
2016-03-29 14:22:35
667
原创 IOS 渐变的图层,CAGradientLayer
创建一个渐变颜色的图层。- (void)viewDidLoad { [super viewDidLoad]; UIColor *color1 = [UIColor redColor]; UIColor *color2 = [UIColor greenColor]; UIColor *color3 = [UIColor blueColor]; CAGradientL
2016-03-17 19:12:12
601
原创 UITextField左边缩进
UIView *spaceView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; textField.textAlignment = NSTextAlignmentLeft; textField.leftViewMode = UITextFieldViewModeAlways; textField.leftView = s
2016-03-09 19:07:32
384
转载 UIView设置指定的border
转自:http://stackoverflow.com/questions/17355280/how-to-add-a-border-just-on-the-top-side-of-a-uiview其实也是往view.layer上面addSublayer,但是挺好用的代码:- (CALayer *)prefix_addUpperBorder:(UIRectEdge)edge color:(UICol
2016-01-05 18:28:22
695
原创 给UIView 的子类们 UIButton UILbel等 。。。。加一个虚线圆角的border
xcode 7.0 developTarget 9.0代码:- (void)createDotBorderForView:(UIView *)view{ view.layer.cornerRadius = 5.0f; CAShapeLayer *border = [CAShapeLayer layer]; border.strokeColor = [UIColor oran
2016-01-05 18:20:58
603
原创 UILabel 文字靠右显示 并且 文字尾部距UILabel有一定的距离,使用attributeString
如题使用UILabel时候想要文字靠右显示,但是不想顶着UILabel的尾部显示,类似于设置UIButton 的edge。 UILabel好像不可以直接设置edge,所以选择使用UILabel的attributedText。以下是代码把想要的Label和想要表示的文字作为参数传入方法就可以了。- (void)setAttributeStringForPriceLabel:(UILabel *)lab
2016-01-03 22:04:57
7911
原创 UICollectionView: 1>UICollectionViewFlowLayout流式布局
环境XCode:Ver 7.2DevelopeTarget: 9.2UICollectionViewFlowlayout CollectionView流式布局========================================================================================================UICollectionView 使
2016-01-03 21:23:38
963
原创 Ipad项目中用到的UIModalPresentationFormSheet,点击阴影部分dismiss 当前presented的controller
这个文章学到的知识:http://my.oschina.net/CreeveLiu/blog/347913?fromerr=Pg3JEnxF背景: xcode:Ver 7.0 sdk:9.0 1>IPAD项目 2>在一个大的controller(mainViewController)中推出一个小的controller(
2015-12-11 10:57:51
3222
原创 移除一个view上面的所有subview
如题:之前一直是遍历subviews,逐个removeFromSuperView.今天发现另外一种简便的方法: [myView.subviewsmakeObjectsPerformSelector:@selector(removeFromSuperview)];PS:加班 时间 过的 很快。 员们别忘了 写代码之余 锻炼身体。
2015-12-09 19:49:45
550
原创 在同一个label上显示 两种规格的字体
第一篇博客! -------------------------------------------------- 需求:在同一个label上显示 两种规格的字体。 例如:把字符串是320M(100M)中的M字号变小. 如图 → -------------------------------------------------- 解决方法: 给UILabel设置文本时候,使用UILa
2015-12-01 18:33:33
1024
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人