MoreNotepad++

--------活出自己的精彩。

导航

文章分类 -  IOS

ios
how-to-get-the-width-of-an-nsstring
摘要:Hi David -Here's a relatively simple approach. Just create an NSAttributedString with the appropriate font and ask for its size:- (CGFloat)widthOfString:(NSString *)string withFont:(NSFont *)font { NSDictionary *attributes = [NSDictionary dictionaryWithObjectsAndKeys:font, NSFontAttributeName, n 阅读全文

posted @ 2014-03-18 11:55 MoreNotepad++ 阅读(195) 评论(0) 推荐(0)

IOS Layer的使用
摘要:ref:http://blog.csdn.net/pjk1129/article/details/6946724CALayer(层)是屏幕上的一个矩形区域,在每一个UIView中都包含一个根CALayer,在UIView上的所有视觉效果都是在这个Layer上进行的。CALayer外形特征主要包括:1、层的大小尺寸2、背景色3、内容(可以填充图片或者使用Core Graphics绘制的内容)4、矩形是否使用圆角5、矩形是否有阴影Layer有很多种,最常用也是最基本的是CALayer,当然还包括其他的子类:CAScrollerLayer 简化显示层的一部分CATextLayer 文本层CAGrad 阅读全文

posted @ 2014-02-11 09:35 MoreNotepad++ 阅读(149) 评论(0) 推荐(0)

iphone4/4s 程序适配 iphone5 过程 经验 全记录
摘要:Ref:http://www.cnblogs.com/ygm900/archive/2013/05/24/3098015.htmliphone4/4s 应用程序升级适配 iphone5 的方法有很多,而且其中原理在网上也找的到。本次废话不多说,单简要叙述我的过程:综合权衡,我选择用增加xib文件的方法。第一步:为需要适配找到工程中需要适配iphone5的xib文件,加入是AViewController。首先,到工程文件目录下,找到AViewController.xib文件,然后在同一文件夹下拷贝一份,重命名为AViewController_ip5.xib 文件。第二步:将AViewContro 阅读全文

posted @ 2014-01-24 09:16 MoreNotepad++ 阅读(153) 评论(0) 推荐(0)

iOS 单例写法
摘要:苹果官方文档中的写法static AccountManager *DefaultManager = nil; + (AccountManager *)defaultManager { if (!DefaultManager) DefaultManager = [[self allocWithZone:NULL] init]; return DefaultManager;} 在iOS4之后有了另外一种写法+ (AccountManager *)sharedManager{ static AccountManager *sharedAccountManagerInsta... 阅读全文

posted @ 2014-01-24 09:07 MoreNotepad++ 阅读(120) 评论(0) 推荐(0)

IOS 使用通讯录
摘要:1 添加AddressBook.framewor AddressBookUI.framework2#import #import 3 检查授权// iOS 6-(bool)checkAddressBookAuthorizationStatus:(UITableView*)tableView;{ ABAuthorizationStatus authStatus = ABAddressBookGetAuthorizationStatus(); if (authStatus != kABAuthorizationStatusAuthorized) { ... 阅读全文

posted @ 2014-01-23 16:21 MoreNotepad++ 阅读(157) 评论(0) 推荐(0)

IOS 实现可移动的UIImageView
摘要://// MovableImageView.h//#import @interface MovableImageView : UIImageView@end //// MovableImageView.m//#import "MovableImageView.h"@implementation MovableImageView- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ [super touchesBegan:touches withEvent:event];}-(void)touches 阅读全文

posted @ 2014-01-23 15:38 MoreNotepad++ 阅读(129) 评论(0) 推荐(0)

IOS 实现截图功能
摘要:-(UIImage *)saveImage:(UIView *)view withRect:(CGRect) mainRect // mainRect 应该是相对于屏幕的Rect{ UIGraphicsBeginImageContext(mainRect.size); CGContextRef context = UIGraphicsGetCurrentContext(); [[UIColor blackColor] set]; CGContextFillRect(context, mainRect); [view.layer renderInContext:co... 阅读全文

posted @ 2014-01-23 15:35 MoreNotepad++ 阅读(93) 评论(0) 推荐(0)

使用内置Mail功能的UI -- MFMailComposeViewController
摘要:1 添加MessageUI.framework2#import - (IBAction)doEmailBtn:(id)sender{ MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init]; mailController.mailComposeDelegate = self; [mailController setToRecipients:@[@"zxm@xxxxxx.com"]]; [mailController setSubject:@"M 阅读全文

posted @ 2014-01-23 15:25 MoreNotepad++ 阅读(120) 评论(0) 推荐(0)

获取UIButton的背景图片
摘要:- (UIImage *)imageForState:(UIControlState)state;- (UIImage *)backgroundImageForState:(UIControlState)state;// 示例[sender imageForState:UIControlStateNormal]; 阅读全文

posted @ 2014-01-23 15:19 MoreNotepad++ 阅读(191) 评论(0) 推荐(0)

UIImagePickerController 使用示例
摘要:从图片库获取数据- (IBAction)doPhotoAlbumBtn:(UIButton *)sender { UIImagePickerController* ipController = [[UIImagePickerController alloc] init]; [self presentViewController:ipController animated:YES completion:nil]; [ipController setDelegate:self];}从相机获取数据UIImagePickerController* ipController = [[U... 阅读全文

posted @ 2014-01-23 15:16 MoreNotepad++ 阅读(139) 评论(0) 推荐(0)

判断设备是否为Simulator
摘要:if ([[[UIDevice currentDevice] model] rangeOfString:@"Sim"].location == NSNotFound) { // TODO} else { NSLog(@"iPhone Simulator can't use this funciton");} 阅读全文

posted @ 2014-01-23 15:09 MoreNotepad++ 阅读(96) 评论(0) 推荐(0)

UIImage 缩放
摘要:- (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize{ UIGraphicsBeginImageContext( newSize ); [image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)]; UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); ... 阅读全文

posted @ 2014-01-23 15:07 MoreNotepad++ 阅读(140) 评论(0) 推荐(0)

IOS 拨打电话
摘要:注意:在模拟器中无法模拟拨号NSString *phone = @"88888888";if (phone != nil) { NSString *telUrl = [NSString stringWithFormat:@"telprompt:%@",phone]; NSURL *url = [[NSURL alloc] initWithString:telUrl]; [[UIApplication sharedApplication] openURL:url];} UIWebView*callWebview =[[UIWebView alloc] in 阅读全文

posted @ 2014-01-23 15:06 MoreNotepad++ 阅读(108) 评论(0) 推荐(0)

如何在iOS中打开Safari
摘要:#define BOOKLINK @"http://www.baidu.com"[[UIApplication sharedApplication] openURL:[NSURL URLWithString:BOOKLINK]]; 阅读全文

posted @ 2014-01-23 15:00 MoreNotepad++ 阅读(324) 评论(0) 推荐(0)