随笔分类 -  iphone

摘要:需求很简单,通过UIViewController.view内的任意控件获取当前UIViewController;立马开写:/** * @brief 通过viewController内的view,获取Controller * * @param view subView * * @return UIViewController */- (UIViewController *)recursionView2ViewController:(UIView *)view{ __block UIViewController *viewController;... 阅读全文
posted @ 2013-11-14 16:53 Maxfong 阅读(13305) 评论(0) 推荐(0) 编辑
摘要:iOS7之前的UI为:而在iOS7中,由于设计方面的原因,使得UI变为:修改的方法重写UINavigationItem的setLeftBarButtonItem和setRightBarButtonItem方法,使之与之前版本兼容;代码如下:@interface UINavigationItem (margin)@end@implementation UINavigationItem (margin)#if __IPHONE_OS_VERSION_MAX_ALLOWED > __IPHONE_6_1- (void)setLeftBarButtonItem:(UIBarButtonItem 阅读全文
posted @ 2013-10-17 22:32 Maxfong 阅读(5409) 评论(8) 推荐(2) 编辑
摘要:dSYM文件获取:1.build2.Archive获取app UUID命令:dwarfdump --uuid YourApp.app.dSYM1.YourApp.app/YourApp2.YourApp.app.dSYM3.Crash log UUID3个一致,则可以执行下面的操作;dwarfdump –lookup 0x00000000 –arch armv6 YourApp.app.dSYMSymbolicatecrash的用法:Symbolicatecrash x.crash x.dSYM > aa.log 阅读全文
posted @ 2013-05-06 16:07 Maxfong 阅读(2921) 评论(0) 推荐(0) 编辑
摘要:学OC,肯定知道内存管理机制的原则。这里说说某些特殊的情况。之前曾说,NSString的计数器比较特殊,大家注意下。今天说另外一种,也是比较纠结的,以至于朋友都说这是OC BUG。。。创建一个Class://H#import <Foundation/Foundation.h>@interface Car : NSObject- (void)show;@end//M#import "Car.h"@implementation Car- (void)show;{ NSLog(@"exec Finished!!!");}@end很简单的show方法 阅读全文
posted @ 2013-03-23 22:04 Maxfong 阅读(4431) 评论(6) 推荐(1) 编辑
摘要:开启MacOS的流量限制,并打开Internet共享,供无线设备使用(或使用模拟器)在终端输入:实时流量下载限制sudo ipfw add 200 pipe 1 ip from any to any insudo ipfw pipe 1 config bw 50Kbytes/s移动2G:20k联通3G:120K时段流量限制sudo ipfw pipe 1 config bw 50kbit/s plr 0.05 delay 10000ms sudo ipfw add pipe 1 dst-port http关闭sudo ipfw flush推荐使用:实时流量下载限制不想敲命令的,直接用这款写好的 阅读全文
posted @ 2013-03-10 13:11 Maxfong 阅读(840) 评论(0) 推荐(0) 编辑
摘要:/* 函数描述:字符串筛选,去掉不需要的特殊字符串 参数描述:target 原字符串 replacement 需要替换的字符串 options 默认传2:NSLiteralSearch,区分大小写 _replaceArray 需要排除的Array 返回值: 筛选完的String 备注: 使用方法:replaceOccurrencesOfString:@"1(2*3" withString:@"" options:2 replaceArray:[NSArray arrayWithObjects:@"(",@"*".. 阅读全文
posted @ 2013-01-28 22:53 Maxfong 阅读(2130) 评论(1) 推荐(1) 编辑
摘要:@property 官方解释:Declared Properties个人理解:@property的意思是自动帮添加get、set方法。而NSString等引用类型,需要使用retain。当我们不手动添加@property,如,建立一个私有变量,自己写get、set方法,通过消息发送,获取变量值。这里,如果此变量类型不为值类型,是否需要在set方法中,做@property的retain所做的事。个人觉得是需要的,即//H@property (nonatomic, retain) NSString *value;//M-(void)setValue:(NSString *)_value{ i... 阅读全文
posted @ 2012-12-08 14:06 Maxfong 阅读(2783) 评论(0) 推荐(1) 编辑
摘要:1.需要添加一张启动图片,大小:640*1136,添加后默认命名为Default-568h@2x.png。图片适配,对于高清的1136图片,命名同样使用@2x,只是改名图片名称,如image-1-os5.png,image-1-os5@2x.png,在代码中判断iphone5?(image-1):(image-1-os5),没有@22x这种。#define iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScr 阅读全文
posted @ 2012-10-04 12:22 Maxfong 阅读(11262) 评论(0) 推荐(3) 编辑
摘要:-(CGAffineTransform)getOrientation{ [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeRight animated:YES]; UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; if (orientation == UIInterfaceOrientationLandscapeLeft... 阅读全文
posted @ 2012-09-28 16:19 Maxfong 阅读(219) 评论(0) 推荐(0) 编辑
摘要:改写的AlertView,有弹出效果,点击任意位置关闭View。效果图:- (IBAction)didPressedClick:(id)sender{ alert = [[UIAlertView alloc] init]; alert.delegate = self; [alert addSubview:aView]; bView.layer.cornerRadius = 10; bView.layer.masksToBounds = YES; [bView.layer setShadowOffset:CGSizeMake(2, 1)]; [bView... 阅读全文
posted @ 2012-09-15 22:28 Maxfong 阅读(408) 评论(0) 推荐(0) 编辑
摘要:@interface Utility : NSObject{}//验证身份证是否有效+ (BOOL)checkIDCard:(NSString *)str;@end@interface Utility ()int checkIDfromchar (const char *sPaperId);@end@implementation Utility//验证身份证是否有效int checkIDfromchar (const char *sPaperId) { long lSumQT =0; int R[] ={7, 9, 10, 5, 8, 4, 2, 1, 6,... 阅读全文
posted @ 2012-09-04 16:00 Maxfong 阅读(396) 评论(0) 推荐(0) 编辑
摘要:假设一段xml:///xmlStr/*<A> <B> <C id='c1'>C1</C> <C>C2</C> <C>C3</C> <C>C4</C> </B> <B> <C id='c2'>C5</C> <C>C6</C> <C>C7</C> </B></A>*/解析出C1-C7的数组: NSMutableArray *m_d 阅读全文
posted @ 2012-06-19 15:44 Maxfong 阅读(963) 评论(0) 推荐(0) 编辑
摘要:这几天写了这款应用,帮助自己学习:页面只有2个: 使用: MBProgressHUD TBXML ASIHTTPRequest再完善完善,等app store审核通过,发代码,呵呵。 阅读全文
posted @ 2012-06-03 15:28 Maxfong 阅读(168) 评论(0) 推荐(0) 编辑
摘要:基本使用: void (^vFun)()=^(void){ NSLog(@"void function"); }; vFun();//void function //void:返回类型 //(^vFun):vFun代表函数名 //(xx):传入参数的类型,为空代表木有参数 //^(xxx):block格式,xxx代表传入参数 int (^iFun)(int) = ^(int i){ return i; }; NSLog(@"%d",iFun(12345));//12345 NSString *str ... 阅读全文
posted @ 2012-05-28 09:58 Maxfong 阅读(1357) 评论(0) 推荐(0) 编辑
摘要:table 阅读全文
posted @ 2012-05-24 11:15 Maxfong 阅读(97) 评论(0) 推荐(0) 编辑
摘要:地址:https://github.com/ 阅读全文
posted @ 2012-05-23 10:13 Maxfong 阅读(154) 评论(0) 推荐(0) 编辑
摘要:http://wiki.magiche.net/很详细的教材,完全参考了。后续更新自己的理解。 阅读全文
posted @ 2012-05-22 14:57 Maxfong 阅读(184) 评论(0) 推荐(1) 编辑
摘要:使用方法简单,说明文档很详细。给UIAlertView增加扩展方法,使它支持多按钮。按钮事件通过BlocksRIButtonItem *cancelItem = [RIButtonItem item];cancelItem.label = @"No";cancelItem.action = ^{//...};RIButtonItem *deleteItem = [RIButtonItem item];deleteItem.label = @"Yes";deleteItem.action = ^{//...};UIAlertView *alertView 阅读全文
posted @ 2012-05-21 15:47 Maxfong 阅读(323) 评论(0) 推荐(0) 编辑
摘要:1.介绍:http://www.xiangwangfeng.com/2.安装:行之有效的方法 1.自动:http://www.99css.com/ 2.手动:http://gaobusi.iteye.com/3.这个app参考了samples里的TTCatalog、TTNavigatorDemo,实现3个页面,功能: 1.Navigator的左右分别添加TTMessage和TTPost,View显示一个经过TTDefaultStyleSheet修改的text和一个image; 2.3个Scroll分别包含各种样式的Button、各种样式的TextField、2款Tabb... 阅读全文
posted @ 2012-05-21 15:39 Maxfong 阅读(720) 评论(1) 推荐(1) 编辑
摘要:方向感应:在ImageViewController.h中添加UIAccelerometerDelegate:@interface ImageViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate, UIAccelerometerDelegate>{//...ImageViewController.m文件内,初始化UIAccelerometer,在viewWillAppear:animated中:- (void)viewWillAppear:(B 阅读全文
posted @ 2012-05-16 09:22 Maxfong 阅读(324) 评论(0) 推荐(0) 编辑