- 博客(61)
- 收藏
- 关注
原创 终端简单的命令 -- 增删改查
查询所有文件 : ls查询详细信息 : ls -l (所属用户,创建时间等8项详细信息)查询隐藏文件 : ls -a可同时使用 ls -al / ls -la波浪线代表小房子切换文件所属路径: cd Des(+tab键就会自动打出来Desktop/(桌面))pwd — 显示当前所属的完整路径通过终端可以新建任意一个文件 touch 例如文本 就写 touch 文本
2015-10-13 19:52:54 510
原创 UI 19 数据库
使用一个单例来做操作数据库的调用者. 首先, 需要去Build Phases 的 Link Binary With Libraries 添加libsqlite3.0#import <Foundation/Foundation.h>#import <sqlite3.h>#import "Student.h"@interface dataBase_Tool : NSObject{ // 用
2015-08-29 17:28:22 392
原创 UI 18 单例
新建一个继承于NSObject的类, 名字为single 单例单例, 就是整个工程只创建这一个. 在.h中写一个+号方法, 一般都是share….// 单例+ (Singleton *)shareSinglenton;+ (Singleton *)shareSinglenton{// // 第一种// static Singleton *single;// if (si
2015-08-29 16:08:23 420
原创 UI 18 UICollectionView
UICollectionView 是 tableView 的升级版!#import "ViewController.h"#import "MyCell.h"#import "UIImageView+WebCache.h"#import "MyCollectionReusableView.h"@interface ViewController ()<UICollectionViewDataSou
2015-08-29 16:02:58 377
原创 UI 16 数据持久化
就是将数据保存在本地. 归档和返归档. 苹果手机为了保证自己数据上的绝对安全.设计了沙盒文件,每一个应用程序都配备了自己的沙河文件,每一次运行,文件夹的名字就会变成没有任何规律的字符串. 第一个参数: 当前前往哪一个文件夹,前往Documents文件用NSDocumentsDirectory, 64行. 还可以前往缓存Caches,对应68行. 第二个参数: 访问的文件夹类型
2015-08-29 15:14:14 355
原创 UI 15 UITableViewController & 系统自带快捷菜单 & 系统下拉刷新
UITableViewController 已经签订好tableView的两个协议,可以直接使用. 只要将必须完成的两个协议的内容写好即可. 下面的代码加入了系统默认的下拉刷新功能, 每次向下拉刷新时都添加一个@”哈哈” 代码实现如下:#import "MainTableViewController.h"@interface MainTableViewController ()@prope
2015-08-29 14:55:55 442
原创 UI 15 NetWorkingTool 封装JSON解析
就是JSON解析方法封装到一个工具类中. 即传入一个网址(字符串),在使用这个工具后, 返回一个解析好的数据. 这也就是用到了协议传值或者block传值法.// 首先是使用协议的方式. 新建一个继承于NSObject的Model类. 名字叫做NetWorkingDelegate 然后进行协议的六步,大家应该还记得吧?!#import <Foundation/Foundation.h>#pr
2015-08-29 14:36:08 269
原创 UI 14 GET & POST 数据请求 & block异步
同步: 请求数据时,其他的事情都做不了. 异步: 请求数据时还可以做其他的.- (void)viewDidLoad { [super viewDidLoad]; self.imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 100, 100, 100)]; self.imageView.backgrou
2015-08-29 11:58:56 369
原创 UI 13 SD的简单使用 &UIActionSheet_从相册获取图片
SD 第三方的使用 引#import “UIImageView+WebCache.h”头文件, 可以在网络获取图片 self.imageview = [[UIImageView alloc] initWithFrame:CGRectMake(80, 100, 250, 350)]; self.imageview.backgroundColor = [UIColor yellowCol
2015-08-29 11:54:12 364
原创 UI 13 数据解析 Parser DOM JSON
Parser 解析 DOM 解析 JSON 解析 现在大部分都是使用JSON解析 stroyboard 里面只有三个button按钮, 分别代表这三种解析.Parser解析#import <Foundation/Foundation.h>#import "Student.h"@interface ParserXML : NSObject<NSXMLParserDelegate>//
2015-08-29 11:43:48 510
原创 UI 10 block 练习
#import "MainViewController.h"#import "SecondViewController.h"@interface MainViewController ()<SecondViewControllerDelegate>@end@implementation MainViewController- (void)viewDidLoad { [super viewD
2015-08-29 11:21:11 280
原创 UI 11 从后向前传值 -- block
前面我们使用协议的方法从后向前传值. 现在学习了block之后, 就很简单啦! 在第一页的.m中#import "MainViewController.h"#import "SecondViewController.h"@interface MainViewController ()<UITableViewDataSource, UITableViewDelegate>@property(
2015-08-29 11:16:55 293
原创 UI10_TableView的编辑
#import "MainViewController.h"@interface MainViewController ()<UITableViewDataSource, UITableViewDelegate>@property(nonatomic, retain)UITableView *tableView;@property(nonatomic, retain)NSMutableArray
2015-08-29 11:07:05 263
原创 UI 10 带分区的省市区......
还是先看一下效果吧~ 区的信息在下一页.#import "MainViewController.h"#import "ZoneTableViewController.h"#define WIDTH self.view.frame.size.width#define HEIGHT self.view.frame.size.height@interface MainViewControlle
2015-08-29 11:03:43 469
原创 UI 09 自定义cell
我们能够发现系统的cell有时候不能够满足我们的要求, 这时候我们就需要自定义属于我们的cell 新建一个继承于UITableViewCell 文件. 注意, cell的属性名字绝对不能够和系统的一样#import <UIKit/UIKit.h>@interface ThreeANDTwoTableViewCell : UITableViewCell@property(nonatomic, r
2015-08-29 10:54:52 375
原创 UI 09 tableView 中国省市区. 一个页面, 三个tableView
感觉省市区要被玩坏了……….#import "MainViewController.h"#define WIDTH self.view.frame.size.width#define HEIGHT self.view.frame.size.height@interface MainViewController ()<UITableViewDataSource, UITableViewDelega
2015-08-29 10:30:38 775
原创 UI 08 tableView版中国省市区 -- 3页
还记得之前写的中国省市区么? 现在我们使用tableView将他显示出来. 里面用到了从前向后属性传值. 第一页效果图如下, 一共31个省 #import "ProViewController.h"#import "CityViewController.h"@interface ProViewController ()<UITableViewDataSource,UITableViewD
2015-08-29 10:23:01 584
原创 UI tableView 的头视图 & "小广告"
self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64) style:UITableViewStylePlain]; [self.view addSubview:self.tableView
2015-08-29 10:15:49 625
原创 UI 07 界面传值 之 从后向前 ---- 协议传值
哎呀… 好久没有写博客了, 今天可以好好的整理一下啦. 前一篇写的是从前向后的属性传值,比较简单.今天要写的协议传值, 就比较麻烦了. 但是之后会更新使用block的方法完成从后向前传值, 会比较简单. 协议传值的六步还记得么? 第一步: 声明一份协议, 写明协议内容 第二步: 设置代理人属性. 第三步: 设置代理人需要完成协议内容里的方法 第四步: 引头文件, 代理人签订协议 第五
2015-08-29 09:11:21 600
原创 UI 07 _ 导航视图控制器 与 属性传值
首先, 先创建三个VC. 完成点击按钮, 进入下一页, 并能够返回.要先把导航视图控制器创建出来. 在AppDelegate.m 文件中代码如下:#import "AppDelegate.h"#import "MainViewController.h"@interface AppDelegate ()@end@implementation AppDelegate- (void)deall
2015-08-13 22:47:29 653
原创 UIPageControl 与 UIScrollView
#import "MainViewController.h"#define WIDTH self.view.frame.size.width#define HEIGHT self.view.frame.size.height@interface MainViewController ()<UIScrollViewDelegate>@property(nonatomic, retain)UIS
2015-08-13 22:10:17 878
原创 UI 06 ScrollView 的手动循环播放 与 自动循环播放
如果想要循环播放的话, scrollView的照片前要加上最后一张图片, 最后要加上第一张图片.- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. //继承于UIView,可以通过创建view的四步对ScrollView进行创建. UI
2015-08-13 17:57:55 679
原创 UI 06 UIScrollView基础
注: 本文已将ARC改为MRC.UIScrollView继承于UIView,可以通过创建view的四步对ScrollView进行创建.UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.heigh
2015-08-13 09:03:14 461
原创 UI 06 _ 7种手势
// UIImageView UIImage *image = [UIImage imageNamed:@"u=3179572108,1349777253&fm=21&gp=0.jpg"]; self.imageView = [[UIImageView alloc] initWithImage:image]; self.imageView.frame = CGRectMake
2015-08-12 22:28:43 1045
原创 UI05 _ 分段控件 -- UISegmentedControl
分段控件提供一栏按钮(有时称为按钮栏),但只能激活其中一个按钮。分段控件会导致用户在屏幕上看到的内容发生变化。它们常用于在不同类别的信息之间选择,或在不同的应用屏幕之间切换。下面介绍基本属性和基本方法的使用。NSArray *arr = [NSArray arrayWithObjects:@"刘大贱",@"刘鑫狗",@"狗狗",@"狗哥", nil]; UISegmentedControl
2015-08-12 21:58:21 652
原创 UI05 _ 播放MP3格式的歌曲
注意: 已将ARC 改为 MRC.第一步,将MP3格式的歌曲拖拽至工程中. 第二步,引入系统的文件.#import <AVFoundation/AVFoundation.h>第三步,引入歌曲的路径NSString *path = [[NSBundle mainBundle] pathForResource:@"眼泪的错觉" ofType:@"mp3"];第四步,创建一个AVAudioPlayer的
2015-08-12 21:12:28 921
原创 UI05_ 制造一个毛玻璃效果
首先,先创建一个UIImageView的对象. 注意, 本文已将ARC改为MRC.UIImageView *imageview = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"222.jpg"]]; imageview.frame = CGRectMake(0, 0, self.view.frame.size.width
2015-08-12 20:49:09 783
原创 UI 04 代理设计模式
delegate 也是用来解耦的, 他不再是简简单单让目标去执行一个动作了,而是让delegate去处理一些事件. 这跟在OC中学习的协议是一样的, 分为6步. 还是创建一个继承于UIView 的 MyButton类. MyButton.h代码如下:#import <UIKit/UIKit.h>// 1.声明一份协议@protocol MyButtonDelegate <NSObject>
2015-08-04 22:23:53 444
原创 UI 04 target...action 设计模式
“高内聚,低耦合”是面向对象编程的核心思想. 使用 target…action 实现解耦. 需要目标去执行一个动作的地方. 例如, 定义一个继承于UIView 的MyButton 类, 让他能够有Button的点击方法. 代码如下: Mybutton.h:#import <UIKit/UIKit.h>@interface Mybutton : UIView//1.写一个自定义方法,把目标
2015-08-04 22:02:32 408
原创 UI 03 自定义的Label-TextField视图 --- LTView
LTView 是自写的继承于 UIView 的类 这其中创建一个UILabel 和一个 UITextField ; 这样可以少些一半的代码. 代码如下: LTView.h#import <UIKit/UIKit.h>@interface LTView : UIView<UITextFieldDelegate>// 因为要在类的外部获取输入框的内容,修改Label的标题,所以我们把这两
2015-08-04 21:41:49 610
原创 UI 03 UIViewController (视图控制器)的7个方法与视图的跳转
新建一个继承于UIViewController 的类 在AppDelegate.m 中写如下代码. //1.创建一个rootViewController对象 RootViewController *rootVC = [[RootViewController alloc]init]; //2.给window设置根视图控制器 self.window.rootViewContro
2015-08-04 20:57:14 548
原创 UI 03 关于UITextField键盘遮挡问题
首先,需要引头文件, 签订协议 已改成 MRC ! //1.三个textfield UITextField *textField1 = [[UITextField alloc]initWithFrame:CGRectMake(100, 200, 150, 40)]; textField1.layer.borderWidth = 1; textField1.layer.cor
2015-08-03 22:48:44 417
原创 UI 03 UIButton 和 UITextField
可以将UIButton 与 UITextField 结合起来使用, 产生如下图的效果. // 新建一个Button UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; button.frame = CGRectMake(100, 300, 50, 50); button.backgroundC
2015-08-03 22:00:32 463
原创 UI 03 UITextField
UITextField 继承于 UIControl . 特殊的技能是可以输入.// 输入框 UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 50, 200, 40)]; textField.backgroundColor = [UIColor whiteColor]; [
2015-08-03 08:50:40 443
原创 UI 02 UIButton
UIButton 继承于 UIControl , UIControl 继承于 UIView.- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWith
2015-08-03 08:41:54 444
原创 UI 01 UILabel
UILabel 继承于 UIView. 它独有的是文本这个属性. UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(120, 200, 150,150)]; label.backgroundColor = [UIColor orangeColor]; [self.window addSubview:label]; [label
2015-07-31 08:56:00 417
原创 UI 01 UIView
创建一个UIView- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { //创建一个和屏幕一样大的window self.window = [[UIWindow alloc] initWithFrame:[[UIScre
2015-07-31 08:35:26 483
原创 OC08 -- 类的类目 , 延展 , 协议
类目分两部分: 1.系统已经写好的类目:按照功能对系统的类方法进行区分. 类目从@interface开始,后面是当前类名字,类名后是分类的功能, 到@end结束. 2.我们创建的类目,一般是为了把系统的类进行扩充. 对系统的类(例:NSString)添加文件Objective-C File {File:StringMethod; File Type:Cat
2015-07-28 21:15:21 689
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人