YIem`s Blog -心比天高命比纸薄-链接找不到的请在站内搜索内容!

2015-12-16 - UI7-----练习

//
// RootViewController.m
// UI7_练习
//
// Created by YIem on 15/12/15.
// Copyright (c) 2015年 www.yiem.net YIem博客. All rights reserved.
//

import "RootViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

// aview.backgroundColor = [UIColor yellowColor];
// [self.view addSubview:aview];
// [aview release];


UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 375 / 2, 667)];
scrollView.backgroundColor = [UIColor yellowColor];
scrollView.contentSize = CGSizeMake(1000, 1000);
[self.view addSubview:scrollView];
[scrollView release];

//

UIView *aView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
aView.backgroundColor = [UIColor cyanColor];
[scrollView addSubview:aView];
[aView release];

// 多个页面


UIScrollView *scrollView1 = [[UIScrollView alloc] initWithFrame:CGRectMake(375 / 2, 0, 375 / 2, 667)];
scrollView1.backgroundColor = [UIColor redColor];
scrollView1.contentSize = CGSizeMake(self.view.frame.size.width * 4, 0);
[self.view addSubview:scrollView1];
[scrollView1 release];
//
UIView *aView1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
aView1.backgroundColor = [UIColor cyanColor];
[scrollView1 addSubview:aView1];
[aView1 release];

///*******<滑动视图自适应边界预留值>***
// VC 中的第一个滑动视图会自动添加一个上边距
self.automaticallyAdjustsScrollViewInsets = YES;
////****<          >
// 导航栏不透明时 坐标系统一没问题
self.navigationController.navigationBar.translucent = NO;



// 标题
UISegmentedControl *seg = [[UISegmentedControl alloc]initWithItems:@[@"电话", @"聊天"]];
seg.frame = CGRectMake(100, 100, 100, 40);
seg.selectedSegmentIndex = 0;
self.navigationItem.titleView = seg;
[seg release];






}

/*

pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation

*/

@end

当前页面是本站的「Google AMP」版。查看和发表评论请点击:完整版 »