05 2013 档案
摘要:如同自定义Cell一样,使用UITableView的函数,可以自定义Section:- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section;例子代码:- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {NSString *sectionTitle=[self tableView:tableViewtitleForHeaderInSection:se
阅读全文
摘要:问题: 前几下应用,在手机appstore上,从中国区切换到了美国地区,之后,再搜索应用,下载中国区的就不能下载了? 错误提示:总是提示要更改帐户地区;解决方法: 设置---appstore----把当前登录的appid注销掉; 打开手机appstore----搜索一下程序---安装---提示输入appid---输入appid---提示帐户切换到中国--- 切换到中国,就可以下载国内应用了;
阅读全文
摘要:1:保存数据 [[NSUserDefaultsstandardUserDefaults] setObject:@"http://www.baidu.com"forKey:@"selectedURL"];2:取数据 NSLog(@" 正在访问---> %@",[[NSUserDefaultsstandardUserDefaults] objectForKey:@"selectedURL"]);3:官方说明:Getting the Shared NSUserDefaults Instance+standardUs
阅读全文
摘要://设置移动效果-(void)setEditing:(BOOL)editing animated:(BOOL)animated{ [super setEditing:editing animated:animated]; [self.tableView setEditing:editing animated:animated]; }-(BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath{ return YES;}-(void)tableVie...
阅读全文
摘要://1:发布通知-----通知回调方法 NSNotificationCenter *refreshWebNotice = [NSNotificationCenterdefaultCenter]; [refreshWebNotice postNotificationName:@"refreshWeb" object:nil]; //2:接收通知----通知回调方法刷新网页;refreshweb [[NSNotificationCenterdefaultCenter] addObserver:selfselector:@selector(refreshWeb) name:@&q
阅读全文
摘要:ps的版本不同的,快捷键也不同的,我这有一份整理好的ps3 的你看看能不能用得上,Ps快捷键工具基本快捷键工具箱(多种工具共用一个快捷键的可同时按【Shift】加此快捷键选取) 矩形、椭圆选框工具:【M】 裁剪工具:【C】 移动工具:【V】 套索、多边形套索、磁性套索:【L】 魔棒工具:【W】 喷枪工具:【J】 画笔工具:【B】 像皮图章、图案图章:【S】 历史记录画笔工具:【Y】 像皮擦工具:【E】 铅笔、直线工具:【N】 模糊、锐化、涂抹工具:【R】 减淡、加深、海棉工具:【O】 钢笔、自由钢笔、磁性钢笔:【P】 添加锚点工具:【...
阅读全文
摘要:#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)-(void)viewDidAppear:(BOOL)animated{ if (iPhone5) { NSLog(@"555555"); } else { NSLog(@"noooooo"); }}方法二...
阅读全文
摘要:1:在- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 代理方法里面设置颜色转换逻辑;2:在-(void)viewDidAppear:(BOOL)animated 重新加载 tableview reloadData;- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ stati...
阅读全文
摘要:方式一:- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ //cell宽度取系统cell width; CGFloat contentwidth = self.tableView.frame.size.width; //字体大小和下面的 heightForCell保持一致; UIFont *font = [UIFont systemFontOfSize:17.0]; //当前cell数据; NSStri...
阅读全文
摘要:PPRevealSideViewController 这是一个开源类;使用: 1:创建一个PPRevealSideViewController,UINavigationController对象; 2: 设置 self.window.rootViewController = slideViewController; 注:要先在-Prefix.pch 预编译文件里面 加上 #import "PPRevealSideViewController.h" 3: 在主页面导航上加一个 UIBarButtonItem 并设置回调方法 enterLeftNavication; 4: 在回调
阅读全文
摘要:/* libxml/tree.h file not found 设置libxml2文件路径 并添加 libxml.2.2.dylib库文件; 1:Project-->Build Settings --> Header Search Paths --->添加 /usr/include/libxml2 2:Project ---> Build Phases ---> Link Binary With Libraries ---> 添加 libxml.2.2.dylib 库文件 ; */
阅读全文
摘要:#import <Foundation/Foundation.h> #import "JSONKit.h" int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; NSString *res = nil; /* * json格式编码 */ //字符串 NSString *str = @"this is a nsstring"; r...
阅读全文
摘要:1:JSON转XML---通常把JSON数据写到Plist文件即可;2:XML数据转JSON-- 使用开源类 XMLReader 先XML数据先转换为 NSDictionary 即可3: 开源类XMLReader 1 // 2 // XMLReader.h 3 // 4 // 5 /* 6 本类使用方法: 7 1:在使用的页面里面 导入本类 #import "XMLReader.h" 8 2: 调用XMLReader 的两个类方法 就可以了,就可以返回字典数据; 9 3:得到 NSDictionary数据,就是JSON 数据了;10 ...
阅读全文
摘要:1.实例变量命名规范:_name下划线起始。国内编程无此习惯,要知道下划线起始的是实例变量2.protected继承类的时候可以用,即子类可用其父类的protected型实例变量3.getter方法名称不能是 -(int)getAge这样,应写为-(int)age;4.带形参的函数中“:”是函数名的一部分5.设置器、访问器,即getter、setter方法6.只读,就是没有setter方法,实例变量可以在getter方法中返回一个默认值,如果用@property属性,则自定义一个getter方法,且最好不要与默认getter方法名重名,例如:@property(retain,nonatomic
阅读全文
摘要:@property和@synthesize总是配对使用的,功能是让编译器自动生成一个与数据成员相关的读写方法,类似与Java的setter/getter方法。@property的参数有三种类型:读写属性: (readwrite/readonly)setter语意:(assign/retain/copy)原子性: (atomicity/nonatomic)读写属性即设置数据成员是可写还是只读,默认是readwrite,如果是readonly则相当于不生成setter方法。原子性即设置数据成员是否可以多线程访问,默认nonatomic,这样性能更好。关于setter语意,举个例子:NSString
阅读全文
摘要:IOS self.使用 个人习惯;只需要在属性初始化的时候使用self.属性,其他时候直接使用属性名就行;使用self.是 使retaincount+1,为了确保当前类对此属性具有拥有权@interface CustomClass : UIViewController{ NSString *str}@property (retain, nonatomic) NSString *str;@implementation CustomClass@synthesize str;-(void)viewDidLoad{ //方法一 用alloc必须手动释放一次 self.str = ...
阅读全文
摘要:/* assign retain copy的setter方法的内部实现 assign: //@property float price; - (void)setPrice:(float)price { _price = price; } - (float)price { return _price; } retain: //@property (retain, readwrite, nonatomic) NSStri...
阅读全文
摘要:Student.h 1 #import <Foundation/Foundation.h> 2 3 @interface Student : NSObject 4 { 5 // 实例变量命名 以 _开头,和系统命名规范一致; 6 7 //1:public的实例变量可以用 -> 方式访问; 8 @public 9 NSString *_publicName;10 //2:默认为protected 权限;子类可以继承;11 @protected12 NSString *_protectedName;13 14 //4:@prope...
阅读全文
摘要:1 //UIBarButtonItem 回调方法; 2 - (void)backToRootVC 3 { 4 //跳转到父视图 默认动画效果; 5 //[self.navigationController popToRootViewControllerAnimated:YES]; 6 7 //跳转到父视图 设置动画效果; 8 [UIView animateWithDuration:1 animations:^{ 9 [UIView setAnimationTransition:UIViewAnimationTransitionFl...
阅读全文
摘要:1 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil 2 { 3 self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; 4 if (self) 5 { 6 7 self.navigationItem.title = @"我收藏的优惠券"; 8 self.editButtonItem.possibleTitles = [NSSet ...
阅读全文