IOS UIAlertController 使用方法】的更多相关文章

在很多种语言中,alert都表示弹窗操作,弹窗功能非常有用,不仅可以用于正式的app功能中,也可以在调试中使用.在OC中,UIAlertController类用来控制弹窗操作.在IOS 8.0之前, 其使用UIAlertView类来控制弹窗,如果我们想弹出一个带有输入框的窗口,可以使用如下的代码: // Prior to iOS 8.0 UIAlertView *alert = [[UIAlertView init] initWithTitle:@"Alert Title" messa…
  iOS常用公共方法 字数2917 阅读3070 评论45 喜欢236 1. 获取磁盘总空间大小 //磁盘总空间 + (CGFloat)diskOfAllSizeMBytes{ CGFloat size = 0.0; NSError *error; NSDictionary *dic = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:&error]; if (error…
ios简单的方法: [UIDevice currentDevice].batteryMonitoringEnabled = YES; double deviceLevel = [UIDevice currentDevice].batteryLevel;  获取当前剩余电量, 我们通常采用上述方法.这也是苹果官方文档提供的. 它返回的是0.00-1.00之间的浮点值. 另外, -1.00表示模拟器.  …
提示框控制器:UIAlertController 提示框按钮:UIAlertAction   功能:用来提示信息,并给出一些可以进行选择的按钮来处理相应的要求.   注意:在Xcode的iOS8 SDK中,UIAlertView和UIActionSheet都被UIAlertController取代.官方库解释: “UIAlertView is deprecated. Use UIAlertController with a preferredStyle of UIAlertControllerS…
跨平台这种事情不管多NB, 总要有些与原生系统交互的方法, 比如  Unity3D与iOS消息交互方法. 一: 建立一个空的Unity工程. File -->  New Project 二: 编写脚本文件 (Test.cs) 在Project选项卡中, create ->C# script, 命名为Test, 双击, 编写此cs文件. using UnityEngine; using System.Collections; public class Main : MonoBehaviour {…
Method Swizzle黑魔法,修改 ios 系统类库方法   版权声明:本文为博主原创文章,未经博主允许不得转载. 一般来说,系统提供的方法已经足够开发了,但是有的时候有些需求用普通方法不好做. 如:在所有的viewcontroll 的viewwillappear:方法之前打个log 你可能会这么做: 1. 建一个uiviewcontroll 父类,重写viewwillappear方法,调用super viewwillappear 方法之前加上log 2. 所有新建的uiviewcontr…
iOS 图片压缩方法 两种图片压缩方法 两种压缩图片的方法:压缩图片质量(Quality),压缩图片尺寸(Size). 压缩图片质量 NSData *data = UIImageJPEGRepresentation(image, compression); UIImage *resultImage = [UIImage imageWithData:data]; 通过 UIImage 和 NSData 的相互转化,减小 JPEG 图片的质量来压缩图片.UIImageJPEGRepresentati…
iOS 图片裁剪方法 通过 CGImage 或 CIImage 裁剪 UIImage有cgImage和ciImage属性,分别可以获得CGImage和CIImage对象.CGImage和CIImage对象都有cropping(to:)方法,传入CGRect的参数表示要裁剪的区域(采用UIImage的坐标). static func cropImage(_ image: UIImage, withRect rect: CGRect) -> UIImage? { if let cgImage = i…
iOS 图片旋转方法 通过 CGImage 或 CIImage 旋转特定角度 UIImage可通过CGImage或CIImage初始化,初始化方法分别为init(cgImage: CGImage, scale: CGFloat, orientation: UIImageOrientation)和init(ciImage: CIImage, scale: CGFloat, orientation: UIImageOrientation).通过UIImageOrientation的不同取值,可以使图…
iOS常用公共方法 1. 获取磁盘总空间大小 //磁盘总空间 + (CGFloat)diskOfAllSizeMBytes{ CGFloat size = 0.0; NSError *error; NSDictionary *dic = [[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:&error]; if (error) { #ifdef DEBUG NSLog(@&quo…