分类 iOS 下的文章


由   YIem   撰写于    浏览:2615  评论:0
// tableView点击方法(void)tableView:(UITableView )tableView didSelectRowAtIndexPath:(NSIndexPath )indexPath{NSLog(@"点击"); // 取消选中效果 [tableView deselectRowAtIndexPath:ind[...]

由   YIem   撰写于    浏览:3549  评论:0
// tableView右部索引栏(NSArray )sectionIndexTitlesForTableView:(UITableView )tableView{return @[@"a", @"1", @"啦"];}

由   YIem   撰写于    浏览:3232  评论:0
// 高度控制// 行高(CGFloat)tableView:(UITableView )tableView heightForRowAtIndexPath:(NSIndexPath )indexPath{return 100;}// 头部高度(CGFloat)tableView:(UITableView *)tableView heightFor[...]

由   YIem   撰写于    浏览:2952  评论:0
// 自定义头部区域(UIView )tableView:(UITableView )tableView viewForHeaderInSection:(NSInteger)section{UIView *header = [[UIView alloc]initWithFrame:CGRectMake(100, 100, 100, 100)];he[...]

由   YIem   撰写于    浏览:2959  评论:0
// 分区头名称(NSString )tableView:(UITableView )tableView titleForHeaderInSection:(NSInteger)section{return @"头头头";}// 分区脚部名称(NSString )tableView:(UITableView )tableView titleForFo[...]

由   YIem   撰写于    浏览:3241  评论:0
// 分割线样式tableV.separatorStyle = UITableViewCellSeparatorStyleSingleLine; // 分割线颜色 tableV.separatorColor = [UIColor greenColor]; // 行高 - 如果使用协议方法设置行高, 此句无效 tableV.rowHeight = 200;

由   YIem   撰写于    浏览:3258  评论:0
第⼀步:声明协议第⼆步:声明代理⼈第三步:执⾏协议方法第四步:签订协议第五步:指定代理⼈第六步:实现协议方法

由   YIem   撰写于    浏览:3169  评论:0
// 背景图片 [navigation.navigationBar setBackgroundImage:[UIImage imageNamed:@"10425.jpg"] forBarMetrics:UIBarMetricsDefault]; ![ // 背景图片[navigation.navigationBar set[...]

由   YIem   撰写于    浏览:2630  评论:0
// 前景色 navigation.navigationBar.barTintColor = [UIColor cyanColor]; // 背景色// navigation.navigationBar.backgroundColor = [UIColor cyanColor];// 边框色 navigation.navigation[...]

由   YIem   撰写于    浏览:3936  评论:0
/********UIPageControl 页码********/ UIPageControl *pcr = [[UIPageControl alloc] initWithFrame:CGRectMake(100, 500, 200, 50)]; // 注意属性 // 注意, 如果不设置页码个数 控件不显示 pcr.numberOfPages[...]

由   YIem   撰写于    浏览:4521  评论:0
UISlide 滑动条UISlider *slide = [[UISlider alloc] initWithFrame:CGRectMake(100, 400, 300, 10)];// 重要属性 // 最小值 slide.minimumValue = 0; // 最大值 slide.maximumValue = 10; // 设置进度位置 sl[...]

由   YIem   撰写于    浏览:3223  评论:0
/****** UISwith 开关******/ // frame只有坐标生效, 大小无效由系统默认指定 UISwitch *swt = [[UISwitch alloc] initWithFrame:CGRectMake(100, 200, 0, 0)]; // 注意触发方式 [swt addTarget:self action:@sele[...]

由   YIem   撰写于    浏览:3284  评论:0
iOS-UI-创建3个UISlider-分别设置划过区域的颜⾊分别为红,黄,蓝-通过控制三个slider改变self.view的背景颜⾊#import "ViewController.h"@interface ViewController ()@property (nonatomic, retain) UISlider *red;@property[...]

由   YIem   撰写于    浏览:3190  评论:0
#import "ViewController.h" @interface ViewController ()@property (nonatomic, retain) UILabel *label;@end@implementation ViewController(void)dealloc{[_label release];[...]

由   YIem   撰写于    浏览:3761  评论:0
/******* 假夜间模式 *********/ // 开关 UISwitch *sw = [[UISwitch alloc] initWithFrame:CGRectMake(100, 200, 100, 100)]; [sw addTarget:self action:@selector(swAction:) forControlEvents[...]

由   YIem   撰写于    浏览:4482  评论:0
SetViewController *setVC = [[SetViewController alloc]init];// 注意坐标设置 setVC.view.frame = CGRectMake(-150, 0, 150, self.view.frame.size.height); [self addChildViewControll[...]

由   YIem   撰写于    浏览:3965  评论:0
self.seg = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"界面1", @"界面2", @"界面3", nil]];self.seg.frame = CGRectMake(100, 100, 200, 30); // 起始选中状态 self.seg[...]

由   YIem   撰写于    浏览:5462  评论:0
// 提示框 // 提示框的样式只有两种 中间 下方 UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"注意" message:@"你是傻逼" preferredStyle:UIAlertControllerS[...]

由   YIem   撰写于    浏览:3562  评论:0
// 容器视图控制器 self.secondVC = [[SecondViewController alloc] init]; // 将VC添加的原因 // 1. 事件沿VC传递 // 2. 防止VC释放而所属View未释放 [self addChildViewController:self.secondVC]; [self.view addS[...]

由   YIem   撰写于    浏览:3506  评论:0
NSUserDefaults 是全局变量 简单信息存储数据到本地// 用来向本地存储一些简单信息 NSUserDefaults *userD = [NSUserDefaults standardUserDefaults]; // 存入BOOL类型数据 [userD setBool:YES forKey:@"isLogin"];[...]

由   YIem   撰写于    浏览:2998  评论:0
iOS-UI-Button按钮自定义图标-图片样式切换 UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];button.frame = CGRectMake(100, 300, 200, 50); // 正常状态 [button setBackgroundImage[...]

由   YIem   撰写于    浏览:3312  评论:0
VC.m#import "ActivityDetailViewController.h"import "ActivityDetailView.h"@interface ActivityDetailViewController ()@end@implementation ActivityDetailViewController

由   YIem   撰写于    浏览:2970  评论:0
// 图片UIImageView UIImageView *imageV = [[UIImageView alloc] initWithFrame:self.view.frame]; // 设置图片 imageV.image = [UIImage imageNamed:@"BackGround"]; [self[...]

由   YIem   撰写于    浏览:4269  评论:0
//***// 文本输入框 - YIem的博客 // command + k 调出键盘 // command + shift + k 关联物理键盘 UITextField *field = [[UITextField alloc] initWithFrame:CGRectMake(label.frame.origin.x, label.frame.[...]

由   YIem   撰写于    浏览:3726  评论:0
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(50, 50, 300, 50)]; // 设置文字内容 label.text = @"YIem 的博客"; // 设置文字颜色 label.textColor = [UIColor greenColor]; /[...]