
iPhone开发
zcw_java
不管你是用诗歌,还是白话文,还是古文,写个故事,重要的是内容和里面承载的道理。同样产品不管你用java还是c,还是c++等,重要的满足客户需求,用心做有灵魂的产品
展开
-
何时用self引用会加1,[UIImage imageNamed]使用
代码粘的多了点,看着清楚一点SetupAccountViewController.h文件,声明m_comBoxView,线程不安全,retain(self调用引用+1)[code="c"]#import #import "ComBoxView.h"@interface SetupAccountViewController : UIViewController{ ...原创 2013-04-07 14:08:40 · 116 阅读 · 0 评论 -
UIImage压缩和缩放
节省大量内存,重绘缩略图;#define K_contentsOfFile(fileName,fileType) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:fileName ofType:fileType]]3种方法,分别是调整、居中、填充方式。[color=red]1、等...原创 2013-07-01 14:31:25 · 248 阅读 · 0 评论 -
NSURL转NSData转UIImage
[code="c++"]NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSString *fileURL = [NSString stringWithFormat:@"http://%@/image/%@/show.jpg?n=%d", 1,1]; ...原创 2013-07-01 15:37:22 · 1232 阅读 · 0 评论 -
NotifiCationCenter控制使用
[align=center]NSNotificationCenter[/align]第一种,这个只是传值,通过NSNotification获取,当然也可以直接使用obj注册A[code="c++"][[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(enableOrDisable...原创 2013-07-02 11:31:48 · 218 阅读 · 0 评论 -
NSDate-常用操作及控制
[align=center]对于NSDate常用操作整理,如有不足请补充[/align]1,获取当前时区时间[code="c++"]//初始化时间段NSDate *date = [NSDate date];//获取当前时区NSTimeZone *zone = [NSTimeZone systemTimeZone];//以秒为单位返回当前应用程序与世界标准时间(格林威...原创 2013-07-05 10:42:59 · 118 阅读 · 0 评论 -
c++结构体在ios端解析
定义宏和结构体[code="c++"]#define ENTRYCOUNT 100#define DATASIZE 256typedef struct alarm_data_struct{ int pos; char data[ENTRYCOUNT][DATASIZE];}stuct_alarm;[/code]将NSString转换cha...原创 2013-07-11 09:20:35 · 178 阅读 · 0 评论 -
NSDate和NSString的转换
[code="c++"]用于uidate,picker。。+(NSDate*) convertDateFromString:(NSString*)uiDate{ NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ; [formatter setDateFormat:@"yyyy年MM月dd日"...原创 2013-07-15 14:43:05 · 115 阅读 · 0 评论 -
NSMutableArray排序
NSMutableArray *array = [NSMutableArray array]; for (int i = 0; i < 10; i ++) { [NSThread sleepForTimeInterval:1.f]; Test23 *test = [[Test23 alloc] init]; test.name...原创 2013-07-26 15:44:41 · 149 阅读 · 0 评论 -
UILable手册
1,自动算出长度,宽度CGSize notRecommentedSize = [labNotRecommented.text sizeWithFont:labNotRecommented.font constrainedToSize:size lineBreakMode:NSLineBreakByWordWrapping];原创 2013-08-02 13:25:38 · 92 阅读 · 0 评论 -
tableview设置上下滚动高度,启用删除
可在viewDidAppear中实现加入 [tablvew setContentOffset:CGPointMake(0,480) animated:YES]; 在tableView内添加一个searchbar,一起滚动;开始时隐藏headerView(即让tableView向上滚动headerView的高度:默认44) UISearchBar *mySearchBar = [[UIS...原创 2013-08-06 17:14:03 · 202 阅读 · 0 评论 -
ios使用预编译命令解决问题
对于MacOS设备不同,做出相应响应[code="c++"]#if TARGET_OS_IPHONE//iPhone真机#elif TARGET_OS_MAC//Mac下#elif TARGET_IPHONE_SIMULATOR//iPhone模拟器#endif//结束[/code]pch是对整个项目的预编译[code="c++"]#ifde...原创 2013-08-12 13:44:10 · 102 阅读 · 0 评论 -
ios文件读写
[code="c++"]//写入缓存文件,缓存目录下 NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask, YES); NSString *strDocumentsDirectory = paths[0]; NSString *strCa...原创 2013-08-12 15:44:26 · 117 阅读 · 0 评论 -
SDWebImage Demo手册
分享源码,有问题回复SDWebImage 异步加载 缓存图片 Http请求次数限制等,期待大家共同研究学习//清楚缓存、磁盘存储-(void)removeImageForKey:(NSString *)key;key就是你那个[url obsoluteString];...原创 2013-08-13 12:58:04 · 118 阅读 · 0 评论 -
ios国际化
前些天升级到Xcode4.5,现在正在用Xcode4.5+IOS6开发项目,当使用国际化时,遇到了一点问题,之前版本Xcode上新建Localizable.strings后,添加语言的“+”号不见了,找了半天无果,自己研究了下,后来在Stackoverflow上找到了解决方案,原来Apple把这个“+”号换地方了。下面来看看如何使用。首先新建一个名为Localizable.strings的...原创 2013-08-15 15:22:38 · 176 阅读 · 0 评论 -
使用MKNetworkKit函数Demo
[color=red]一、引入MKNetworkKit[/color][color=blue]1,[/color]添加MKNetworkKit的到工程目录。[color=blue]2,[/color]添加的CFNetwork.Framework,SystemConfiguration.framework,Security.framework和ImageIO.Framework。[c...原创 2013-08-16 13:41:40 · 285 阅读 · 0 评论 -
Tableview详解
一,为tableview中cell,修改其样式[code="c++"][tableView deselectRowAtIndexPath:indexPath animated:YES]; UITableViewCell *celling = [tableView cellForRowAtIndexPath:indexPath]; for (int i = 0; i < ...原创 2013-08-22 15:47:18 · 277 阅读 · 0 评论 -
转载ios开发资源汇总
如何用Facebook graphic api上传视频: http://developers.facebook.com/blog/post/532/ Keychain保存数据封装: https://github.com/carlbrown/PDKeychainBindingsController 对焦功能的实现: http://www.clingmarks.com/?p=612...原创 2013-06-28 15:02:26 · 137 阅读 · 0 评论 -
ios将模拟器与真机.a文件合并
1,command+b build一下工程2,Debug-iphoneos和Debug-iphonesimulator文件下都会出现一个.a文件3,将Debug-iphonesimulator中重命名xxx_i386.a4,将两个文件都拷贝到一个目录下,打开终端5,xxxiMac:111 Ken$ [color=red]lipo -info libupnpx_i386.a [...原创 2013-06-24 16:54:10 · 282 阅读 · 0 评论 -
初始化initWithNibName与viewDidLoad
initWithNibName初始化nib文件,加载结束调用viewDidLoadviewDidLoad在初始化nib文件后的初始化工作,可以用于初始化ui。。。后期补全原创 2013-04-08 12:31:00 · 103 阅读 · 0 评论 -
addSubview对于引用计数操作
[code="c"]- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ static NSString *cellIdetifier = @"blogCellIdentifier"; UITableViewCell ...原创 2013-04-11 10:19:37 · 412 阅读 · 0 评论 -
NSTimer
启动 Timer[color=blue]– fire[/color]停止 Timer[color=blue]– invalidate[/color]Timer设置[color=blue]– isValid– fireDate– setFireDate:– timeInterval– userInfo[/color][code="c"]self.m...原创 2013-04-24 16:32:39 · 126 阅读 · 0 评论 -
NSString常用操作
[code="c"]//将NSData转化为NSString NSString* str = [[NSString alloc] initWithData:response encoding:NSUTF8StringEncoding];//将NSString 转化为NSData (NSString.h)- (NSData *)dataUsingEncoding:(...原创 2013-04-27 19:06:28 · 160 阅读 · 0 评论 -
ios NavBar+TarBar技巧
NavBar+TarBariphone开发 NavBar+TarBar1 改变NavBar颜色:选中Navigation Bar 的Tint属性。选中颜色。 2 隐藏“back”按钮: self.navigationItem.hidesBackButton = YES; 3 隐藏"NavBar" : self.navigationController.navigati...原创 2012-11-16 10:25:15 · 89 阅读 · 0 评论 -
IOS之JsonKit解析,版本号获取
版本号的获取如下:[code="c"]NSString *executableFile = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleExecutableKey]; NSString *version = [[[NSBundle mainBundle] infoDicti...原创 2013-05-20 14:28:08 · 100 阅读 · 0 评论 -
iPhone获取wifi列表
首先,app如果要上app store是没有办法获取wifi列表的~这些WIFI扫描软件使用了苹果的私有函数apple80211.framework尽管不能合法(指能通过App Store的审核)的获取WIFI列表, 不过我们还是可以获取到当前Wifi连接的信息,比如SSID.SSID全称Service Set IDentifier, 即Wifi网络的公开名称.苹果...原创 2013-05-21 17:13:56 · 381 阅读 · 0 评论 -
Reachability使用说明<转载>
一:确认网络环境3G/WIFI 1. 添加源文件和framework 开发Web等网络应用程序的时候,需要确认网络环境,连接情况等信息。如果没有处理它们,是不会通过Apple的审(我们的)查的。 Apple 的 例程 Reachability 中介绍了取得/检测网络状态的方法。要在应用程序程序中使用Reachability,首先要完成如下两部: ...原创 2013-05-28 09:56:01 · 172 阅读 · 0 评论 -
iphone常用线程编写
1,创建一个新的子线程[code="c"]//在分线程中操作[NSThread detachNewThreadSelector:@selector(saveUserData) toTarget:self withObject:nil];[/code]2,如果不在主线程中,将其加入主线程[code="c"]//如果当前非主线程,将其加入主线程if (![NSThr...原创 2013-06-03 15:29:00 · 68 阅读 · 0 评论 -
使用模态视图
下面两个是模态视图两个动画的参数,设置的时候可以写成[code="c"]self.modalPresentationStyle = 1;[self presentModalViewController:navSetWireless animated:YES];//modalTransitionStyle跟modalPresentationStyle相互对应[/code]...原创 2013-06-05 16:28:28 · 185 阅读 · 0 评论 -
NSOrderedSame NSOrderedAscending NSOrderedDescending枚举比较a==b
[code="c++"] NSString 两个字符串的比较,用 a compare:b 来比,得出的结果分3种 1. 26个字母比较 越靠后面 越大 NSString *a = @"qweqwe"; NSString *b = @"qweasd"; BOOL result = [a compare:b]; if (result == NS...原创 2013-06-14 15:55:42 · 122 阅读 · 0 评论 -
UI圆角以及阴影等效果利用layer属性
制作圆角button等[code="c++"]//必须导入的空间#import就拿view来举例view.layer.masksToBounds=YES; //设置为yes,就可以使用圆角view.layer.cornerRadius= 5; //设置它的圆角大小view.layer.borderWidth=1; //视图的边框宽度view.layer.bord...原创 2013-06-17 10:42:52 · 190 阅读 · 0 评论 -
PickerView准备捕获时间,循环滚动demo
最重要的下面几行代码[code="c++"]- (void) clickRightBarItem{ NSInteger row0 = [m_pickerSetupAlarmDate selectedRowInComponent:0]; NSInteger row1 = [m_pickerSetupAlarmDate selectedRowInComponent:1]...原创 2013-06-18 15:09:00 · 148 阅读 · 0 评论 -
UITableViewCell自定义
添加到选中cell中,每一个cell闪烁1秒[tableView deselectRowAtIndexPath:indexPath animated:YES];设置cell背景色和背景图[code="c++"]UIView *backgrdView = [[UIView alloc] initWithFrame:cell.frame];backgrdView.backgro...原创 2013-06-18 16:22:50 · 142 阅读 · 0 评论 -
push隐藏Tabbar,navBar
[self.navigationController setNavigationBarHidden:YES];self.navigationController.hidesBottomBarWhenPushed = YES; //这句是隐藏tabbar返回时先[self.navigationController setNavigationBarHidden:NO]; 或在前...原创 2013-06-14 12:00:51 · 108 阅读 · 0 评论 -
ios序列化对象存储本地
[code="c"]#import @interface WeiboUserInfo : NSObject{ NSString *m_strDeviceJid; //绑定的设备的jid NSString *m_strSinaJid; //sina帐号的jid NSString *m_strSinaPasswd; //sina帐...原创 2013-09-10 14:14:56 · 246 阅读 · 0 评论