代码
XFDevelop
不断学习,不断超越!!!
展开
-
关于rangeOfString判断是否存在字符串bug
NSString *testStr; NSLog(@”—–>%lu,%lu”, [testStr rangeOfString:@”=”].location,[testStr rangeOfString:@”=”].length); if ([testStr rangeOfString:@”=”].location != NSNotFound) { NSLog(@原创 2016-05-26 14:29:38 · 442 阅读 · 0 评论 -
xib 创建view加载
CustomView *v = [[[NSBundle mainBundle] loadNibNamed:@"CustomView" owner:self options:nil]lastObject]原创 2016-05-16 11:05:58 · 220 阅读 · 0 评论 -
注册cell
//xib[_tabView registerNib:[UINib nibWithNibName:@"CustomCell" bundle:nil] forCellReuseIdentifier:@"cellID"]//代码[_tabView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"]原创 2016-05-16 11:04:06 · 241 阅读 · 0 评论 -
cell点击时上面的空间颜色都变成背景色处理
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{ [super setHighlighted:highlighted animated:animated]; if (highlighted) { self.contentView.backgroundColor = GRAY_2LIGH原创 2015-11-30 10:23:16 · 177 阅读 · 0 评论 -
自定义cell
cell复用,当cell不在视线内时调用- (void)prepareForReuse{ [super prepareForReuse]; //可以将cell上得一些内容重置}cell高亮时调用- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated{ [super setHighlighted:h原创 2015-11-30 10:32:47 · 184 阅读 · 0 评论 -
设置超过父视图视图隐藏
self.clipsToBounds = YES;原创 2015-11-30 13:52:28 · 1388 阅读 · 0 评论 -
tableviewcell输入框键盘隐藏
- (void)viewDidLoad { [super viewDidLoad]; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(removeKeyBoard)]; tap.delegate = self; [self原创 2015-12-08 11:30:22 · 197 阅读 · 0 评论 -
获取网络时间
{ NSURLConnection *_connection; void(^_netWorkTimeBlock)(NSString *netWorkTime);}/** * 获取网络时间 * * @param nowNetWorkTimeBlock 返回时间 / 或者无网络状态信息 */- (void)getNetworkTimeBlock:(void(^)(原创 2015-12-08 14:49:38 · 493 阅读 · 0 评论 -
NSDate 与 NSDateFormatter
NSDate *date = [NSDate dateWithTimeIntervalSince1970:timeValue];NSDateFormatter *formatter = [[NSDateFormatter alloc] init];[formatter setDateFormat:@"yyyy-MM-dd hh:mm:ss"];//hh代表几位01/1NSString *tim原创 2015-12-21 15:25:21 · 200 阅读 · 0 评论 -
设置父视图的alpha不影响子视图的
self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.7];原创 2015-12-17 10:49:42 · 450 阅读 · 0 评论 -
动态更新约束
/** * 键盘即将出现 */- (void)keyboardWillShow:(NSNotification *)notif{ NSDictionary *info = [notif userInfo]; NSValue *value = [info objectForKey:UIKeyboardFrameBeginUserInfoKey]; CGSize key原创 2015-12-25 10:04:48 · 277 阅读 · 0 评论 -
键盘遮挡解决
- (void)dealloc{ [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKey原创 2015-12-28 10:37:54 · 277 阅读 · 0 评论 -
调用系统电话
第一种:[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"tel://10086"]];第二种:UIWebView*callPhoneWebview =[[UIWebView alloc] init];NSURL *telURL =[NSURL URLWithString:@"tel:10086"]; //(tel原创 2015-12-28 14:18:16 · 244 阅读 · 0 评论 -
tabbar显示原图
nav.tabBarItem.image = [[UIImage imageNamed:tabBarIcons[i]] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];原创 2016-01-18 10:07:29 · 340 阅读 · 0 评论 -
复制到剪切板
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];pasteboard.string = @"content";原创 2016-02-26 17:23:01 · 314 阅读 · 0 评论 -
使用UIAlterView时设置window问题
//取出的是当前window,是UIAlterView生成的windowUIWindow *window = [UIApplication sharedApplication].keyWindow;//取第一个window,为程序开始的windowUIWindow *window = [[[UIApplication sharedApplication] windows] firstObjec原创 2016-03-02 17:41:17 · 382 阅读 · 0 评论 -
pch文件添加
添加新文件, 选择iOS-Other-PCH File 设置配置 target-Build Settings 搜索 header 选择Prefix Header 填入 工程名/**.pch原创 2016-05-16 17:43:21 · 271 阅读 · 0 评论