随笔分类 -  iOS常用代码

1 2 下一页
用UICollectionView实现点击展开收缩的cell
摘要:#import "GoodsToSaleViewCell.h" #import "GoodsOnSaleController.h" #import "GoodsToSaleViewCell.h" @interface GoodsOnSaleController ()<UICollectionView 阅读全文
posted @ 2018-02-01 11:17 i兮兮 阅读(830) 评论(0) 推荐(0)
怎样在导航条上添加多个item
摘要:情况一:右侧两个按钮 //为导航栏添加右侧按钮1 UIBarButtonItem *right1 = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"my_share"] imageWithRenderingMode:UII 阅读全文
posted @ 2017-12-04 08:33 i兮兮
一组按钮,其中一个选中,其余取消选中效果
摘要:第一,定义一个全局的按钮变量 @property (nonatomic, strong) UIButton *selectedBtn; 第二,循环创建按钮 //好评中评差评按钮 _normalArr = [NSArray arrayWithObjects:@"goodBtn_normal",@"mi 阅读全文
posted @ 2017-11-28 21:27 i兮兮
iOS 不在线好友头像(UIImage)置灰
摘要:#import "ViewController.h" typedef enum { ALPHA = 0, BLUE = 1, GREEN = 2, RED = 3 } PIXELS; @interface ViewController () @end @implementation ViewCont 阅读全文
posted @ 2017-11-14 14:28 i兮兮
UIAlertController 使用总结
摘要:1:自带单个输入框的UIAlertController UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil message:@"请输入备注信息" preferredStyle:UIA 阅读全文
posted @ 2017-10-18 11:08 i兮兮
addChildViewController 学习记录
摘要:// // HMTMainViewController.m // UIScrollView // // Created by HMT on 14-6-25. // Copyright (c) 2014年 humingtao. All rights reserved. // #import "HMTM 阅读全文
posted @ 2017-10-17 11:15 i兮兮
实现UITableViewCell的全选单选效果
摘要:RelatedCompanyCell.h里 @property (strong, nonatomic) IBOutlet UIImageView *companyPhoto; @property (strong, nonatomic) IBOutlet UILabel *companyName; @ 阅读全文
posted @ 2017-09-27 10:40 i兮兮
storyboard或者Xib给View设置边框属性(颜色,宽度,圆角)
摘要:纯代码设置Button或者其他View的边框属性 例: UIView* view = [[UIView alloc]init]; view.layer.borderWidth = 2.0; view.layer.masksToBounds = YES; view.layer.cornerRadius 阅读全文
posted @ 2017-09-27 08:27 i兮兮
设置NavigationBar的背景为透明
摘要:In Objective-C [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationController 阅读全文
posted @ 2017-09-18 09:55 i兮兮 阅读(692) 评论(0) 推荐(0)
CollectionView既有头视图又有分组视图
摘要:#import "ViewController.h" #import "CustomViewCell.h" #import "CollectionHeadView.h" @interface ViewController ()<UICollectionViewDelegate, UICollecti 阅读全文
posted @ 2017-09-06 11:05 i兮兮 阅读(205) 评论(0) 推荐(0)
UITableView基础
摘要:UITableView基本使用方法 1.首先,Controller需要实现两个delegate ,分别是UITableViewDelegate 和UITableViewDataSource 2.然后 UITableView对象的 delegate要设置为 self。 3.然后就可以实现这些deleg 阅读全文
posted @ 2016-06-16 14:09 i兮兮 阅读(124) 评论(0) 推荐(0)
UICollectionView基础
摘要:初始化部分: UICollectionViewLayout UICollectionViewLayout决定了UICollectionView如何显示在界面上,Apple提供了一个最简单的默认layout对象:UICollectionViewFlowLayout。 Flow Layout是一个Cel 阅读全文
posted @ 2016-06-03 10:32 i兮兮 阅读(162) 评论(0) 推荐(0)
关于TextView
摘要:Q:怎样让textview里的文字从最顶开始显示? 我的textview总是空出一大截才开始显示文字的。如图所示: A:用导航跳转过去,他会减去64像素 也就是导航的高度,都是ScrollView引起的,加上self.automaticallyAdjustsScrollViewInsets = NO 阅读全文
posted @ 2016-05-04 10:49 i兮兮 阅读(141) 评论(0) 推荐(0)
xcode7、iOS9 设置启动图片(Launch Image)
摘要:一.添加启动图片 二.拖入相应尺寸的图片,以本例子需要为例。 我试了一下这里的图片名字可以任意命名,不过格式必须为png格式. 640*960 (4/4s) 2X位置 640*1136 (5/5s/5c) R4位置 750*1334 (6) R4.7位置 1242*2208 (6 plus) R5. 阅读全文
posted @ 2016-04-29 15:32 i兮兮 阅读(288) 评论(0) 推荐(0)
iOS使用自定义字体
摘要:1、向工程内添加*.tff字体文件。 2、检查*.tff字体文件是否包含在Target -> Bundle Phases -> Copy Bound Resources 下的列表中没有就添加进来。 3、编辑工程的Info.plist文件 (1)addRow—Fonts provided by app 阅读全文
posted @ 2016-04-15 17:35 i兮兮 阅读(1729) 评论(0) 推荐(1)
Git命令参考手册
摘要:git init # 初始化本地git仓库(创建新仓库) git config --global user.name "xxx" # 配置用户名 git config --global user.email "xxx@xxx.com" # 配置邮件 git config --global color 阅读全文
posted @ 2016-04-08 14:02 i兮兮 阅读(115) 评论(0) 推荐(0)
iOS - 正则表达式判断邮箱、手机号码验证、车牌号验证、车型、用户名、密码、昵称、身份证号
摘要://邮箱 + (BOOL) validateEmail:(NSString *)email { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; NSPredicate *emailTest = [ 阅读全文
posted @ 2016-04-05 15:04 i兮兮 阅读(286) 评论(0) 推荐(0)
iOS 判断邮箱格式是否正确的代码
摘要:-(BOOL)isValidateEmail:(NSString *)email { NSString *emailRegex = @"[A-Z0-9a-z._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,4}"; NSPredicate *emailTest = [NSPre 阅读全文
posted @ 2016-01-28 09:23 i兮兮 阅读(308) 评论(0) 推荐(0)
IOS 记录用户登陆状态
摘要:今天要说的是如何记录我们用户的登陆状态。例如微信,QQ等,在用户登陆后,关闭应用在打开就直接登陆了。那么我们在App开发中如何记录用户的登 陆状态呢?之前在用PHP或者Java写B/S结构的东西的时候,我们用Session来存储用户的登陆信息,Session是存在服务器上仅在一次回话 中有效,如果要 阅读全文
posted @ 2016-01-27 15:39 i兮兮 阅读(399) 评论(0) 推荐(0)
ios 软键盘的相关处理
摘要:1.触摸键盘以外的屏幕回收键盘 //回收键盘- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [self.view endEditing:YES];} 2.点击软键盘上完成按钮回收键盘 *在.m中签订协议<UIText 阅读全文
posted @ 2016-01-27 15:34 i兮兮 阅读(264) 评论(0) 推荐(0)

1 2 下一页