//

#import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
    // Custom initialization
}
return self;
}
阅读全文 »

#pragma mark - 重写屏幕方向发生改变触发的方法
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
// 判断为横屏或者竖屏
if (!UIInterfaceOrientationIsPortrait(toInterfaceOrientation)) {
    // 调用调整位置的方法
    [self _initAllItemsWithHorizontal];
} else {
    [self _initAllItemsWithVertical];
}
}
阅读全文 »

 // UISearchBar的常用方法 搜索框
UISearchBar *oneSearchBar = [[UISearchBar alloc] init];
oneSearchBar.frame = CGRectMake(0, 0, 320, 70); // 设置位置和大小
oneSearchBar.keyboardType = UIKeyboardTypeEmailAddress; // 设置弹出键盘的类型
oneSearchBar.barStyle = UIBarStyleBlackTranslucent; // 设置UISearchBar的样式
oneSearchBar.tintColor = [UIColor redColor]; // 设置UISearchBar的颜色 使用clearColor就是去掉背景
oneSearchBar.placeholder = @"请输入:"; // 设置提示文字
阅读全文 »

// UITextView的常用方法 主要用来输入和显示多行文本信息
UITextView *oneTextView = [[UITextView alloc] init];
oneTextView.frame = CGRectMake(0, 20, 320, 200); // 设置位置
oneTextView.backgroundColor = [UIColor whiteColor]; // 设置背景色
oneTextView.alpha = 1.0; // 设置透明度
oneTextView.text = @"18331000747  1096455447@qq.com lizi1020@sina.cn  www.baidu.com"; // 设置文字
阅读全文 »

// UIPageControl的常用方法
UIPageControl *onePageControl = [[UIPageControl alloc] init];
onePageControl.frame = CGRectMake(10, 100, 300, 30); // 设置位置
onePageControl.backgroundColor = [UIColor redColor]; // 设置背景色
阅读全文 »

// UIActivityIndicatorView的常用方法 活动指示器,就是旋转进度轮
UIActivityIndicatorView *oneIndicatorView = [[UIActivityIndicatorView alloc] init];
oneIndicatorView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge; // 设置显示的样式
阅读全文 »

// UIAlertView的常用方法
// 标准样式
UIAlertView *oneAlertView = [[UIAlertView alloc] initWithTitle:@"标题" message:@"提示内容" delegate:self cancelButtonTitle:@"关闭" otherButtonTitles:@"OK", nil];
[oneAlertView show]; // 显示出来
[oneAlertView release], oneAlertView = nil; // 释放内存
阅读全文 »

// UISegmentedControl的使用
NSArray *oneArrayForSegmentedControl = [NSArray arrayWithObjects:@"1", @"2", @"3", @"4", nil];
UISegmentedControl *oneSegmentedControl = [[UISegmentedControl alloc] initWithItems:oneArrayForSegmentedControl]; // 初始化时加入items
oneSegmentedControl.frame = CGRectMake(20, 20, 280, 40);
oneSegmentedControl.tintColor = [UIColor redColor]; // 选中的颜色
阅读全文 »

// UIStepper的常用方法
UIStepper *oneStepper = [[UIStepper alloc] init];
oneStepper.frame = CGRectMake(20, 20, 20, 20);
oneStepper.backgroundColor = [UIColor blueColor]; // 设置背景色
oneStepper.tintColor = [UIColor yellowColor]; // 设置按钮的颜色
oneStepper.alpha = 1.0; // 设置透明度 范围0.0-1.0之间
阅读全文 »