随笔分类 -  IOS开发基础(UI)

1 2 3 4 下一页

IOS 打开照相机 打开相册
摘要:/** * 打开照相机 */ - (void)openCamera { if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) return; UIImagePickerController *ipc = [[UIImageP... 阅读全文

posted @ 2017-04-04 10:52 守望星空 阅读(236) 评论(0) 推荐(0)

IOS 拉伸图片(封装)
摘要:/** * 根据图片名返回一张能够自由拉伸的图片 */ +(UIImage *)resizedImage:(NSString *)name { UIImage *image=[UIImage imageWithName:name]; return [image stretchableImageWithLeftCapWidth:image.size.width*0.5... 阅读全文

posted @ 2017-03-29 21:36 守望星空 阅读(144) 评论(0) 推荐(0)

IOS 搜索条制作(UITextField 封装)
摘要:封装到 HMSearchBar.h / .m #import <UIKit/UIKit.h> @interface HMSearchBar : UITextField + (instancetype)searchBar; @end #import "HMSearchBar.h" @implement 阅读全文

posted @ 2017-03-29 21:35 守望星空 阅读(200) 评论(0) 推荐(0)

IOS 控制当前控制器支持哪些方向
摘要:#pragma mark - 实现这个方法来控制屏幕方向 /** * 控制当前控制器支持哪些方向 * 返回值是UIInterfaceOrientationMask* */ - (NSUInteger)supportedInterfaceOrientations { /** * UIInterfaceOrientationMaskPortrait : 竖屏... 阅读全文

posted @ 2017-03-23 22:15 守望星空 阅读(127) 评论(0) 推荐(0)

IOS 监听slider滑动
摘要:// 监听slider滑动 - (IBAction)valueChnage:(UISlider *)sender; @property (weak, nonatomic) IBOutlet NJView *circleView; @end @implementation NJViewController - (IBAction)valueChnage:(UISlider *)sende... 阅读全文

posted @ 2017-03-21 22:02 守望星空 阅读(494) 评论(0) 推荐(0)

IOS - (id)initWithStyle... 方法的使用
摘要:// 该方法只有在通过代码创建控件的时候才会调用, 如果控件是通过xib或者storyboard创建出来的不会调用该方法- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifie 阅读全文

posted @ 2017-03-21 20:42 守望星空 阅读(270) 评论(0) 推荐(0)

IOS UISwitch控件的基本使用
摘要:* UISwitch继承自UIControl,因此也能像UIButton一样监听一些事件,比如状态改变事件* UISwitch可以通过拖线监听状态改变* UISwitch可以通过addTarget:...方法监听状态改变- (void)addTarget:(id)target action:(SEL 阅读全文

posted @ 2017-03-21 20:22 守望星空 阅读(480) 评论(0) 推荐(0)

IOS Modal(切换另外控件器方式)
摘要:● 除了push之外,还有另外一种控制器的切换方式,那就是Modal ● 任何控制器都能通过Modal的形式展示出来 ● Modal的默认效果:新控制器从屏幕的最底部往上钻,直到盖住之前的控制器为止 ● 以Modal的形式展示控制器 - (void)presentViewController:(UI 阅读全文

posted @ 2017-03-10 13:49 守望星空 阅读(243) 评论(0) 推荐(0)

IOS UITabBarController(控制器)的子控制器
摘要:UITabBarController的简单使用 ● UITabBarController的使用步骤 ➢ 初始化UITabBarController ➢ 设置UIWindow的rootViewController为UITabBarController ➢ 根据具体情况,通过addChildViewCo 阅读全文

posted @ 2017-03-10 13:43 守望星空 阅读(2236) 评论(0) 推荐(0)

IOS 获取文本焦点 主动召唤出键盘(becomeFirstResponder) and 失去焦点(退下键盘)
摘要:退出键盘 阅读全文

posted @ 2017-03-09 22:52 守望星空 阅读(472) 评论(0) 推荐(0)

IOS UITextFieldDelegate (常用的代理方法)
摘要:#pragma mark - UITextFieldDelegate // 返回NO代表着文本输入框不可以改变(不可以编辑) - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { r... 阅读全文

posted @ 2017-03-09 22:28 守望星空 阅读(253) 评论(0) 推荐(0)

IOS UIActionSheet(底部 弹出框的使用)
摘要:UIActionSheet *sheet = [[UIActionSheet alloc] initWithTitle:@"确定要注销?" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:@"确定" otherButtonTitles:nil]; [sheet showInView:self.vie... 阅读全文

posted @ 2017-03-09 22:25 守望星空 阅读(157) 评论(0) 推荐(0)

显示 Mac隐藏的文件夹 命令语句
摘要:默认情况下,模拟器的目录是隐藏的,要想显示出来,需要在Mac终端输入下面的命令 显示Mac隐藏文件的命令:defaults write com.apple.finder AppleShowAllFiles Yes 隐藏Mac显示文件的命令:defaults write com.apple.finde 阅读全文

posted @ 2017-03-09 19:54 守望星空 阅读(127) 评论(0) 推荐(0)

IOS storyboard(控件器的 生命周期)
摘要:@interface NJTwoViewController () @end @implementation NJTwoViewController // 当控制器的view加载完毕就调用 - (void)viewDidLoad { [super viewDidLoad]; NSLog(@"Two 阅读全文

posted @ 2017-03-08 16:49 守望星空 阅读(154) 评论(0) 推荐(0)

IOS 移除栈顶的控制器
摘要:- (IBAction)back2Two:(id)sender { // 移除当前栈顶的控制器 [self.navigationController popViewControllerAnimated:YES]; } - (IBAction)back2root:(id)sender { // 移除除了栈底控制器的所有控制器 [self.navigationC... 阅读全文

posted @ 2017-03-08 16:46 守望星空 阅读(199) 评论(0) 推荐(0)

IOS 导航控制器基本使用(UINavigationController代码创建方式)
摘要:● UINavigationController的使用步骤 ➢ 初始化UINavigationController ➢ 设置UIWindow的rootViewController为UINavigationController ➢ 根据具体情况,通过push方法添加对应个数的子控制器 ➢ 初始化UIN 阅读全文

posted @ 2017-03-08 16:39 守望星空 阅读(394) 评论(0) 推荐(0)

IOS 控制器View的创建方式(方式的优先级 、view的延迟加载)
摘要:MJViewController的view的创建 的方式的优先级 控制器view的延迟加载 ● 控制器的view是延迟加载的:用到时再加载 ● 可以用isViewLoaded方法判断一个UIViewController的view是否已经被加载 ● 控制器的view加载完毕就会调用viewDidLoa 阅读全文

posted @ 2017-03-08 16:35 守望星空 阅读(215) 评论(0) 推荐(0)

IOS 模仿有storyboard的项目控制器的创建
摘要:● 先加载storyboard文件(Test是storyboard的文件名) UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Test" bundle:nil]; ● 接着初始化storyboard中的控制器 ➢ 初始化“初 阅读全文

posted @ 2017-03-08 16:33 守望星空 阅读(102) 评论(0) 推荐(0)

IOS 控件器的创建方式(ViewController)
摘要:● 控制器常见的创建方式有以下几种 ➢ 通过storyboard创建 ➢ 直接创建 NJViewController *nj = [[NJViewController alloc] init]; ➢ 指定xib文件来创建 NJViewController *nj = [[NJViewControll 阅读全文

posted @ 2017-03-08 16:23 守望星空 阅读(205) 评论(0) 推荐(0)

IOS Window窗口使用
摘要:// 程序启动完毕之后就会调用一次 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 1.创建UIWindow self.window = [[UIWindow alloc] initWithFr... 阅读全文

posted @ 2017-03-08 16:09 守望星空 阅读(173) 评论(0) 推荐(0)

1 2 3 4 下一页

导航