- 博客(19)
- 收藏
- 关注
原创 BLOCK传值 协议传值
通过使用Block实现从后往前传值写协议或添加属性@protocol SecondViewControllerDelegate<NSObject>-(void)changeColor;@end@interface SecondViewController : UIViewController@property(nonatomic,retain)id<SecondViewControllerD
2015-08-26 17:47:44
386
原创 对UITableView的一些设置
通过设置UITableView的属性实现cell的移动,删除,编辑移动cell-(void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath{//先获取到起始位置的数据 NSS
2015-08-17 19:40:31
408
原创 Cell自适应高度
让Cell自动适应高度自定义cell#import "MyCell.h"//contentView是每个cell的view//下面的define是定义成每个cell的高度和宽度#define WIDTH self.contentView.frame.size.width#define HEIGHT self.contentView.frame.size.height@implementat
2015-08-17 19:29:19
499
原创 UITableView的协议传值
主要实现协议传值内部的传值所用的控件不再详述声明协议SecondViewController.h//1.声明一份协议@protocol SecondViewController <NSObject>-(void)changeValue:(NSString *)str;@end@interface SecondViewController : UIViewController@propert
2015-08-16 13:09:24
447
原创 UITableView的基础部分
UITableView的基础部分内容UITableView的基本设置#import "MainViewController.h"#import "SecondViewController.h"@interface MainViewController ()//签订协议<UITableViewDataSource,UITableViewDelegate>@property(nonatomic
2015-08-16 12:02:05
481
原创 协议传值
协议传值是针对从后往前传值先要自己定义协议 并且写协议方法 通过协议方法进行传值//协议传值的第一步// 1.声明一份协议@protocol SecondViewControllerDelegate <NSObject>//协议方法-(void)changeValue:(NSString *)value;@end//在SecondViewController中声明协议@interfac
2015-08-16 11:13:15
299
原创 UINavigationController
标题UINavigationController的创建和应用//头文件#import "MainViewController.h"先创建一个viewControllerMainViewController *mainVC = [[MainViewController alloc]init];//创建导航视图控制器UINavigationController *naVC = [[UINavig
2015-08-16 10:42:13
449
原创 UIPageControl
UIPageControl配合UIScrollView使用self.scrollView = [[UIScrollView alloc]initWithFrame:self.view.frame];self.scrollView.backgroundColor = [UIColor yellowColor];[self.view addSubview:self.scrollView];self
2015-08-16 09:50:48
325
原创 UIScrollView
UIScrollView的创建//UIScrollView继承UIView,可以通过创建view的四步对其进行创建UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height)];scr
2015-08-13 20:44:09
267
原创 AVAudioPlayer&UIImageView的Tomcat连续播放&UISlider&UISegmentedControl
一些简单控件的属性和应用方法AVAudioPlayer的创建和方法//声明属性@property(nonatomic,retain)AVAudioPlayer *play;//viewdidload中实现初始化对象NSString *path = [[NSBundle mainBundle] pathForResource:@"Hardwell - Eclipse" ofType:@"mp3"
2015-08-12 20:53:58
401
原创 手势识别器
手势识别器的实现和方法手势识别器的应用主要是针对图片,所以在文件内部先声明了一个UIImageView对象,用来进行下面的模拟//声明的UIImageView@property(nonatomic,retain)UIImageView *imageView;//以下为UIImageView对象的准备工作UIImage *image = [UIImage imageNamed:@"123.jpg
2015-08-11 20:40:28
341
原创 Target-Action
创建MyButton类,继承UIView通过MyButton实现button的点击效果//MyButton.h//1.通过自定义的方法,把目标和动作传到类的内部-(void)addNewTarget:(id)target Action:(SEL)action;//Target:目标,button执行哪一个类的方法,对应的目标就是那个类的对象//action:动作,让button具体做什么事,执
2015-08-11 19:25:31
339
原创 Delegate
UI部分协议的使用方法首先创建了一个Cocoa Touch Class的MyButton类,这个类并没有继承UIButton,而是继承了UIView以下内容写在MyButton类的.h文件中,属于声明部分//1.声明一份协议@protocol MybuttonDelegate <NSObject>-(void)changeColor;@end@interface MyButton : UIV
2015-08-09 17:46:10
307
原创 UIViewController
UIViewController的用法方法和实现首先创建一个新的根视图,并在视图中添加一定的布局下面布局的button是为了跳转其他页面时用来写单击事件的//铺一个buttonUIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];button.frame = CGRectMake(100, 500, 150, 40);[
2015-08-09 17:25:00
218
原创 LTView&AlertView
LTView的属性和方法因为要在类外部获取输入框的内容,修改lable的标题,所以将lable和textfield写成属性放在.中,这样在外部可以直接进行修改和设置@interface LTView : UIView<UITextFieldDelegate>//这里已经将输入框的协议入了@property(nonatomic,retain)UILabel *myLable;@property(no
2015-08-09 15:45:09
327
原创 UITextField
UITextField创建输入框确定输入框的位置和大小UITextField *textFiled = [[UITextField alloc] initWithFrame:CGRectMake(100, 100, 200, 40)];输入框的背景颜色textFiled.backgroundColor = [UIColor redColor];输入框的边框宽 圆角 边框颜色textFiled.lay
2015-08-09 12:07:16
310
原创 UIButton
UIButton的属性和方法用button自己的便利构造器的方式来创建对象UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];指定button的位置和大小button.frame = CGRectMake(100, 100, 150, 70);给button设置背景颜色button.backgroundColor = [U
2015-08-09 11:25:07
325
原创 UIView
UIView的方法和属性创建UIView对象UIView *view1 = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)];设置背景颜色view1.backgroundColor = [UIColor greenColor];把视图贴到窗口上[self.window addSubview:view1];视图的坐标起始位置在父视
2015-08-09 10:57:53
237
原创 UILable
UILable的一方法UILable的初始化UILabel *lable1 = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 340, 150)];对文本进行赋值lable.text = @"";文本内容的颜色lable1.textColor = [UIColor redColor];文本对齐的方式lable1.textAlignment = N
2015-08-09 10:40:12
298
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人