ccc
caoyudong · 共 29 篇文章
日期格式
NSDate *datepl = [NSDatedateWithTimeIntervalSince1970:strDara.intValue]; NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateStyle:NSDateFormatterMediumStyle]; [formatter setTimeStyle:NSDateFormatterShortStyle]; [formatter setDateFormat:@"YYYY-MM-dd"]; NSString *strLabelD…
2015-03-24 16:56 · 评论(0)
从webview获取到NSString url
NSURLRequest *request = [mWebView request]; NSURL *url = [request URL]; NSString *strUrl = [url absoluteString];
2015-03-24 14:35 · 评论(0)
iOS 8 UIAlertController
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"标题" message:@"这个是UIAlertController的默认样式" preferredStyle:UIAlertControllerStyleAlert]; [alertController addTextFieldWithConfigurationHandler:^(UITextField *textField){ textField.placeholder = @"输入手机号"; }]; [alertContr…
2015-02-10 13:59 · iOS 弹出窗口 · 评论(0)
iOS 刷新
// // ViewController.m // BookStore // // Created by cyd on 14-11-21. // Copyright (c) 2014年 cyd. All rights reserved. // #import "IndexViewController.h" #import "UIViewController+MMDrawerController.h" @interface IndexViewController () @end @implementation IndexViewController int flag=0; (void)view…
2014-12-31 16:37 · 评论(0) · iOS · 刷新
objective-c 关于数组补充
NSArray *values=[dictionaryListData allValues]; NSArray *keys=[dictionaryListData allKeys];
2014-12-31 11:43 · 评论(0)
联系人分组
url:http://mobile.9sssd.com/ios/art/967 #import <UIKit/UIKit.h> 2 @interface HomeViewController : UIViewController 3 <UITableViewDelegate, UITableViewDataSource>{ 4 } 5 @property (nonatomic, retain) NSDictionary *contactTitles;//存储所有的联系人信息 6 @property (nonatomic, retain) NSArray *groups;//所有分类名称存入数…
2014-12-31 11:31 · 评论(0) · iOS
切换Controller中的不同UIView且不会覆盖前面一个UI
第一次进来的时候: 1⃣️ m_imageViewGraphs = [[UIImageView alloc]initWithImage:[self minuteLinesView]]; [self.view addSubview:m_imageViewGraphs]; 2⃣️ m_axisUnit=[[AxisUnitPriceView alloc]initWithFrame:CGRectMake(2, 390, 20, 250) :m_difference :m_beginPrice]; 3⃣️m_showBar=[[ShowBar alloc]initWithFrame:CGRectMa…
2014-12-30 11:33 · 评论(0)
求数组中最大值和最小值
NSNumber *max=[m_listData valueForKeyPath:@"@max.doubleValue"]; NSNumber *min=[m_listData valueForKeyPath:@"@min.doubleValue"];
2014-12-30 11:25 · 评论(0) · Objective-C
滑动scrowview 上方菜单选项的下环线随着移动 效果
UIView: -(id)initWithFrame:(CGRect)frame :(id)target :(SEL)sel { self=[super initWithFrame:frame]; if (self) { scrow.delegate=target; m_showBar=[[ShowBar alloc]initWithFrame:CGRectMake(15, 28, 70, 2)]; [self addSubview:m_showBar]; } return self; } -(void)setShowBarPoint :(CGPoint)barPoint { m_showB…
2014-12-30 11:10 · 评论(0) · iOS · 滑动效果
多个UIButtion写在UIScrowView中调用同一个点击事件
UIView: -(void)creatButton:(id)target :(SEL)sel { for (int i=0; i<3; i++) { btn=[[UIButton alloc]initWithFrame:CGRectMake(i*130, 0, 100, 30)]; btn.tag=i; switch (i) { case 0: [btn setTitle:@"AAA" forState:UIControlStateNormal]; [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];…
2014-12-30 10:56 · 评论(0) · iOS
ScrowView具体用法
//UIView: -(id)initWithFrame:(CGRect)frame :(id)target :(SEL)sel { self=[super initWithFrame:frame]; if (self) { controller=target; //传一个id类型的controller [self creatScrow]; f_tableA=[self creatTableA]; //f_ 表示设置为全局变量 f_tableB=[self creatTableB]; } return self; } -(void)creatScrow { scrow=[[UIScrollV…
2014-12-30 10:32 · 评论(0)
objective-c rangeOfString若数组中某个元素含有某个字符,则去除这个元素
-(NSMutableArray *)containCharacter :(NSMutableArray *)arrayDynamic { for (int i=0; i<arrayDynamic.count; i++) { if ( rangeOfString:@"hk"].length>0) ; if ( rangeOfString:@"jj"].length>0) ; } return arrayDynamic; }
2014-12-26 09:48 · 评论(0) · rangeofstring
将UNicode编码转化为UTF-8
(NSString *)replaceUnicode:(NSString *)unicodeStr { NSString *tempStr1 = [unicodeStr stringByReplacingOccurrencesOfString:@"\u"withString:@"\U"]; NSString *tempStr2 = [tempStr1 stringByReplacingOccurrencesOfString:@"""withString:@"\""]; NSString *tempStr3 = [[@"""stringByAppendingString:tempStr2] s…
2014-12-24 13:14 · 评论(0) · iOS · utf-8 · unicode
请求Json数据,并且解析Json数据
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://api.douban.com/v2/book/search?tag=computer"]]; //将请求的url数据放到NSData对象中 NSData *response = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:nil]; //IOS5自带解析类NSJSONSerialization从response中解析出数…
2014-12-24 11:58 · 评论(0) · iOS
iOS 利用CocoaPods,在项目中导入AFNetworking类库
网址:http://code4app.com/article/cocoapods-install-usage pod install --verbose --no-repo-update ruby环境:https://ruby-china.org/wiki/install_ruby_guide
2014-12-24 11:54 · 评论(0)