@interface UIButton (AsyncImage) //size by point - (void)setImageFromURL:(NSString *)urlString adjustToSize:(CGSize)size completion:(void (^)(void))completion logo:(UIImage *)logoImage; @end @implemen
想在程序 开始或者进入某个界面,到结束程序或退出某个界面,获取到这个持续时间.获取到这个时间还需要转化一个取得时分秒. startTime == 全局变量 NSString *startTime; //开始的地方调用 -(NSString*)getCurrentTime{ NSDateFormatter *formatter = [[NSDateFormatteralloc] init]; [fo
#pragma mark -发送短信 @interface ViewController () { UIAlertView *mfAlertview;//定义一个弹出框 } -(void)showMessageViewController { if( [MFMessageComposeViewController canSendText] )//判断是否能发短息 { MFMessageCompos
- (void)textFieldDidBeginEditing:(UITextField *)textField{ NSArray *ws = [[UIApplication sharedApplication] windows]; for(UIView *w in ws){ NSArray *vs = [w subviews]; for(UIView *v in vs){ if([[NSStr
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimu
@interface UIImage (Resize) //按形状切割图像 - (UIImage*)cutImageWithRadius:(int)radius; @end //图片剪切 - (UIImage*)cutImageWithRadius:(int)radius { UIGraphicsBeginImageContext(self.size); CGContext
1.导入库文件MediaPlayer.framework 2.#import<MediaPlayer/MediaPlayer.h> // 本地文件 NSURL *url = [[NSBundle mainBundle] URLForResource:@"xxxxxxxxxxxxxxx" withExtension:@"mov"]; // 沙盒中的网络路径 (注意这两种方式的区别) NSURL *v
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(60, 100, 200, 300)]; _imageView.image = [UI
处理UILabel根据文字长度和大小自动适应宽度和高度 //这个frame是初设的,没关系,后面还会重新设置其size。 UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0,0,0,0)]; label.numberOfLines = 0; label.backgroundColor = [UIColor clearColor]
1 调用相机并且上传照片的方法 #import "ViewController.h" #import "AFNetworking.h" @interface ViewController () <UIActionSheetDelegate,UIImagePickerControllerDelegate,UINavigationControllerDelegate> @property (wea
实现原理比较简单,这里不做过多介绍. #import "ViewController.h" @interface ViewController () @property (weak, nonatomic) IBOutlet UILabel *titleLabel; @property (copy , nonatomic)NSString *contentStr; @end - (void)view
- (void) fadeOut: (id) sender { CGContextRef context = UIGraphicsGetCurrentContext(); [UIView beginAnimations:nil context:context]; [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; [UIView se
CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = CGRectMake(0, 170*RATIO, _barViewTableView.bounds.size.width+50*RATIO, 365*RATIO); gradient.colo
IOS关于通讯录的开发有两种,一种是直接调用系统的通讯录界面,根据回调信息处理数据,另一种是直接获取系统的通讯录,完全自定义UI,并且可以通过官方给我们提供的接口进行读写。这篇博客主要讨论第二种方式。
在iOS5.0以下,在程序中是不能直接设置系统屏幕亮度的,到了ios5.0以后将这个api开放给了开发者,这样我们就可以非常方更的更改系统屏幕的亮度, 使用方法也很简单 ,如下: 获取系统屏幕当前的亮度值
最近项目,要判断用户的手机是安卓的还是ios的,搜了一下相关的资料,最终获得的结果。事实证明,是有效的!主要是要用到HTTP_USER_AGENT,它表示的意思是用来检查浏览页面的访问者在用什么操作系
iOS获取应用程序信息 NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; 其中的信息示范: 版本
。(注意) 1、下载iOS微信SDK。 下载地址 2、将SDK放到工程目录中。 3、补充导入一些依赖框架。 4、添加URL Types 5、添加iOS9 URL Schemes
便。下面会给出获取数据区的代码。 1. 从UIView中获取图像相当于窗口截屏。 (ios提供全局的全屏截屏函数UIGetScreenView(). 如果需要特定区域的图像,可以crop一下)
iOS上创建桌面快捷方式应用场景: 在iOS设备桌面创建app内某一个模块或页面的快捷方式,通过该快捷方式可以直接进入相应模块或页面。目前app内有该功能的有高德一键导 航,360安全卫士的小火箭。技术原理: