随笔分类 -  笔记

摘要:float version = [[[UIDevice currentDevice] systemVersion] floatValue]; 阅读全文
posted @ 2012-07-24 11:34 高笑228 阅读(134) 评论(0) 推荐(0)
摘要:- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { ... 阅读全文
posted @ 2012-07-12 10:18 高笑228 阅读(2111) 评论(0) 推荐(0)
摘要:iPhone上实现Default.png动画iPhone上实现Default.png动画 原理: 添加一张和Default.png一样的图片,对这个图片进行动画,从而实现Default动画的渐变消失的效果。 操作: 在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOpti*****:(NSDictionary *)launchOpti*****中添加如下代码: // Make this interesting. UIImageView *s... 阅读全文
posted @ 2012-07-09 11:03 高笑228 阅读(273) 评论(0) 推荐(0)
摘要:-(BOOL) isEmailAddress:(NSString*)email { NSString *emailRegex = @"^\\w+((\\-\\w+)|(\\.\\w+))*@[A-Za-z0-9]+((\\.|\\-)[A-Za-z0-9]+)*.[A-Za-z0-9]+$"; NSPredicate *emailTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", emailRegex]; return [emailTest evaluateWithObject:emai 阅读全文
posted @ 2012-07-08 17:38 高笑228 阅读(474) 评论(0) 推荐(0)
摘要:// AppDelegate *AppD = (AppDelegate*)[[UIApplication sharedApplication]delegate] ;// AppD.tabBarController.selectedViewController = [AppD.tabBarController.viewControllers objectAtIndex:2]; 阅读全文
posted @ 2012-07-07 15:46 高笑228 阅读(234) 评论(0) 推荐(0)
摘要:你可曾遇到过viewWillAppear没有被调用到的情况产生原因是用了UINavigationController.将UINavigationController的view作为subview添加到了其他viewController的view中。或者把UINavigationController添加到UITabbarController中了。此时,NavigationController的stack里面的viewController就收不到-(void)viewWillAppear:(BOOL)animated;等4个方法的调用。 原因呢 Apple Docs state:Warning: I 阅读全文
posted @ 2012-06-18 14:10 高笑228 阅读(1472) 评论(0) 推荐(0)
摘要:在头文件中引入framework加入#import <MessageUI/MessageUI.h> 到InAppEmailViewController.h显示 MFMailComposeViewController UIMFMailComposeViewController与其他view controller一样; 我们可以在InAppEmailViewController 使用presentModalViewController使其滑入屏幕。替换InAppEmailController.m中的buttonPressed方法:1234567- (IBAction)buttonPre 阅读全文
posted @ 2012-06-18 12:09 高笑228 阅读(207) 评论(0) 推荐(0)
摘要:- (void)onClick:(id)sender{ UIButton *helpImageBtn = (UIButton *)sender; [UIView animateWithDuration:1.25f animati*****:^{ // fade out helpImageBtn.alpha = 0.0f; } completion:^(BOOL fini... 阅读全文
posted @ 2012-06-18 11:47 高笑228 阅读(202) 评论(0) 推荐(0)
摘要:NSBundle *bundle = [NSBundle mainBundle]; NSURL *plistURL = [bundle URLForResource:@"provinceCities" withExtension:@"plist"]; NSLog(@"%@", plistURL); self.dictionary = [NSDictionary dictionaryWithContentsOfURL:plistURL]; NSArray *components = [dictionary allKeys]; NSArr 阅读全文
posted @ 2012-06-14 00:43 高笑228 阅读(184) 评论(0) 推荐(0)
摘要:-(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{ if (scrollView.contentOffset.y < -80) { [UIView beginAnimations:nil context:nil]; [UIView setAnimationDuration:0.3]; [scrollView setContentInset:UIEdgeInsetsMake(80, 0, 0, 0)];// [scrollView setContentInse 阅读全文
posted @ 2012-06-13 23:31 高笑228 阅读(1423) 评论(0) 推荐(0)
摘要:1.首先在Appdalegate.h 修改如下@interface AppDelegate : UIResponder <UIApplicationDelegate>{ UINavigationController *_navigationController;}@property (nonatomic, retain)UINavigationController *navigationController;2.然后在Appdalegate.m 修改如下 self.navigationController = [[UINavigationController alloc]initW 阅读全文
posted @ 2012-05-31 23:37 高笑228 阅读(2457) 评论(0) 推荐(0)
摘要:慎用ViewCtrl的跳转!搞iphone开发的,应该都知道MVC,顶半边天的UIViewCtrl,区分好Modle、View、Controller各自的作用。这里要提醒的是,勿滥用UIViewCtrl的跳转。从一个Controller跳转到另一个Controller时,一般有以下2种:1、利用UINavigationController,调用pushViewController,进行跳转;这种采用压栈和出栈的方式,进行Controller的管理。调用popViewControllerAnimated方法可以返回。2、利用UIViewController自身的presentModalViewC 阅读全文
posted @ 2012-05-30 14:32 高笑228 阅读(3528) 评论(0) 推荐(0)
摘要:在cocoachina 上看到一篇文章 http://www.cocoachina.com/newbie/basic/2012/0511/4237.html UITableView 异步加载图片缓存正好我也在学习UITableView 所以模仿了一个 拿来练手- (void)viewDidLoad{ [super viewDidLoad]; self.listTableViewArray = [NSMutableArray arrayWithCapacity:1]; NSString *jsonStr = [NSString stringWithContentsOfURL:[NSUR... 阅读全文
posted @ 2012-05-28 22:40 高笑228 阅读(2642) 评论(0) 推荐(0)
摘要:iOS设备现在有三种不同的分辨率:iPhone 320x480、iPhone 4 640x960、iPad 768x1024。以前程序的启动画面(图片)只要准备一个 Default.png 就可以了,但是现在变得复杂多了。下面就是 CocoaChina 会员做得总结 如果一个程序,既支持iPhone又支持iPad,那么它需要包含下面几个图片:Default-Portrait.png iPad专用竖向启动画面 768x1024或者768x1004Default-Landscape.png iPad专用横向启动画面 1024x768或者1024x748Default-PortraitUpsi... 阅读全文
posted @ 2012-05-24 17:20 高笑228 阅读(192) 评论(0) 推荐(0)
摘要:可以用字符串来找方法SEL 变量名 = NSSelectorFromString(方法名字的字符串);//注意 变量名 不是指针 可以运行中用SEL变量反向查出方法名字字符串NSString *变量名 = NSStringFromSelector(SEL参数); 阅读全文
posted @ 2012-05-04 23:31 高笑228 阅读(423) 评论(0) 推荐(0)
摘要:label.transform = CGAffineTransformMakeRotation(90 *M_PI / 180.0);//顺时针旋转 90度label.transform = CGAffineTransformMakeRotation(180 *M_PI / 180.0);//顺时针旋转180度label.transform = CGAffineTransformMakeRotation(270 *M_PI / 180.0);//顺时针旋转270度CGAffineTransform transform = label.transform;transform = CGAffineT 阅读全文
posted @ 2012-05-04 23:30 高笑228 阅读(15016) 评论(0) 推荐(0)
摘要:[[UIApplication sharedApplication] setStatusBarHidden:YES];隐藏状态栏[UIApplication sharedApplication].applicationIconBadgeNumber =5; 给应用程序贴标记[[UIApplication sharedApplication] setIdleTimerDisabled:YES]; 不让程序待机使用网络活动指示器(即状态栏菊花转动)UIApplication *app = [UIApplication sharedApplication]; app.networkActivityI 阅读全文
posted @ 2012-05-04 23:23 高笑228 阅读(1045) 评论(0) 推荐(1)
摘要:release一个对象后立即把指针清空 (release一个空指针完全是合法的,不会发生任何事情)[object release];object = nil;指针赋值给另一个指针NSMutableArray *array = [[NSMutableArray alloc]init];NSLog(@"%d",[array retainCount]);//count is 1NSMutableArray *temp = array;[temp retain];NSLog(@"%d,%d",[array retaincount],[temp retaincou 阅读全文
posted @ 2012-05-04 23:23 高笑228 阅读(136) 评论(0) 推荐(0)
摘要:loadView: (加载视图) - 建立层次结构 - 在不使用 Interface Builder 的时候发生viewDidLoad: (视图已加载) - 加载附加的资源和数据viewWillAppear: (视图快要被显示) - 准备在屏幕上加载 - 视图不会在每次显示重新加载viewDidAppear: (视图已被显示) - 动画和其他视觉元素被加载执行优先顺序从上往下 阅读全文
posted @ 2012-05-04 23:20 高笑228 阅读(216) 评论(0) 推荐(0)
摘要:分别给出BOOL,int,float,指针变量 与“零值”比较的 if 语句(假设变量名为var)解答: BOOL型变量:if(!var)int型变量: if(var==0)float型变量: const float EPSINON = 0.00001;if ((x >= - EPSINON) && (x <= EPSINON)指针变量: if(var==NULL)剖析: 考查对0值判断的“内功”,BOOL型变量的0判断完全可以写成if(var==0),而int型变量也可以写成if(!var),指针变量的判断也可以写成if(!var), 上述写法虽然程序都能正确运行 阅读全文
posted @ 2012-05-04 23:19 高笑228 阅读(211) 评论(0) 推荐(0)