控件

一、Label

<span style="font-size:18px;"><span style="font-size:18px;">UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(100, 100, 100, 100)];
    label.backgroundColor = [UIColor redColor];
    label.text = @"文字 这是文字啊,长沙,湖南中国";
    //63, 130, 139 = (r, g, b)
    label.textColor = [UIColor colorWithRed:63/255.0 green:130/255.0 blue:139/255.0 alpha:1];
    label.font = [UIFont systemFontOfSize:24];
    //文字的阴影设置
    label.shadowColor = [UIColor yellowColor];
    label.shadowOffset = CGSizeMake(10, -20);
    //文本的对齐方式
    label.textAlignment = NSTextAlignmentRight;
    //右对齐
    label.lineBreakMode = NSLineBreakByTruncatingMiddle;
    //如果显示不了就省略中间部分
    label.numberOfLines = 0;//0表示自动调节行数
    [self.view addSubview:label];
    
    NSLog(@"%@", [UIFont fontNamesForFamilyName:@"Zapfino"]);
</span></span>
相对而言,label比较简单一点。主要的属性有text,backgroundColor,font,text Color等。


二、view

<span style="font-size:18px;"><span style="font-size:18px;"> UIView *colorview=[[UIView alloc]init];
    colorview.frame=CGRectMake(0, 50, 100, 200);
    colorview.backgroundColor=[UIColor redColor];
    [self.view addSubview:colorview];
    
   UIView *greenView=[[UIView alloc]init];
    greenView.frame=CGRectMake(100, 50, 100, 200);
    greenView.backgroundColor=[UIColor greenColor];
    [self.view addSubview:greenView];//red与green平齐
    
   // [colorview addSubview:greenView];
    
    UIView *blueview=[[UIView alloc]initWith
Frame:CGRectMake(100, 0, 100, 200)];//相对坐标
    blueview.backgroundColor=[UIColor blueColor];
    [greenView addSubview:blueview];//bule在green之上</span></span>
view也相对比较简单,值得注意的是显示时

[self.view addSubview:colorview];//现实在view之上。

[greenView addSubview:blueview]; //现实bulegreen之上。


三、image/imageview

<span style="font-size:18px;">    UIImage *image11 = [UIImage imageNamed:@"1.png"];//类调用类方法
    UIImage *image22 = [UIImage imageNamed:@"2.png"];
    UIImageView *imageView1 = [[UIImageView alloc] init];//实例化对象
    imageView1.image = image11;
    imageView1.highlightedImage = image22;
    imageView1.highlighted = NO;//NO
    //显示位置和大小
    imageView1.frame = CGRectMake(50, 250, 200, 200);
    [self.view addSubview:imageView1];

    UIImageView *imageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(50, 50, 200, 200)];
    
    UIImage *image0 = [UIImage imageNamed:@"1.png"];
    UIImage *image1 = [UIImage imageNamed:@"2.png"];
    UIImage *image2 = [UIImage imageNamed:@"3.png"];
    UIImage *image3 = [UIImage imageNamed:@"4.png"];
    UIImage *image5 = [UIImage imageNamed:@"6.png"];
    //创建一个OC的数组,并且设置它里面的元素
    NSArray *array = [NSArray arrayWithObjects:image0, image1, image2, image3, image5,nil];
    //背景图片
    imageView2.image = image0;
    //动画执行的时长,单位为秒
    imageView2.animationDuration = 3;
    //动画图片数组
    imageView2.animationImages = array;
    //重复次数,默认为无限循环
    imageView2.animationRepeatCount = 3;
    //开始执行动画
    [imageView2 startAnimating];
    [self.view addSubview:imageView2];</span>


<span style="font-size:18px;"><span style="white-space:pre">	</span>UIImageView *imageView1 = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"1.tiff"<span style="white-space:pre">	</span>]];//初始化,设置背景图片
    imageView1.frame = CGRectMake(0, 0, 320, 480);
    NSMutableArray *array1 = [NSMutableArray array];//NUMytableArray可变数组
                               //类方法调用属性
    for (int i = 1; i <= 61; i++)
    {
    NSString *str = [NSString stringWithFormat:@"%d.tiff", i];//字符串才有给i赋值的属性
        UIImage *image = [UIImage imageNamed:str];
        [array1 addObject:image];//此处比较特殊,需要注意
    }
    imageView1.animationImages = array1;
    imageView1.animationDuration = 3;//播放时间
    imageView1.animationRepeatCount = 4;//循环次数
    
    [self.view addSubview:imageView1];</span>
image和imageview一般是在一起使用。image的作用只是用来存放图片没有其他属性比如坐标,大小,背景等都没有,

唯一值得注意的是它有两个状态一个是普通状态,一个是高亮状态。

imageview是用来显示图片它拥有相对较多的属性显示多张图片时有两种方法一种是一张一张赋给image,另外一种是使用for循环,两者有较大的区别需要注意。


四、UIbutton

1、系统提供

UIButton *btn=[UIButton buttonWithType:UIButtonTypeSystem];

    btn.frame=CGRectMake(200, 64, 100, 40);

    [btn setTitle:@"按钮" forState:UIControlStateNormal];

    btn.backgroundColor=[UIColor greenColor];

    [btn addTarget:self action:@selector(didclicked1:) forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:btn];

2、用户自定义按钮

 UIButton *musicButton=[UIButton buttonWithType:UIButtonTypeCustom];

    musicButton.frame=CGRectMake(220, 400, 67, 53);

    [musicButton setImage:[UIImage imageNamed:@"b"] forState:UIControlStateNormal];

    //按钮按下去是高亮状态

    [musicButton setImage:[UIImage imageNamed:@"a"] forState:UIControlStateHighlighted];

    [musicButton addTarget:self action:@selector(didpalymusic:)  forControlEvents:UIControlEventTouchUpInside];

    [self.view addSubview:musicButton];

3、用代码实现点击

-(void)didpalymusic:(UIButton *)sender

{

    AudioServicesPlayAlertSound(musicID);  //结合用户自定义按钮中倒数第二句构成

}


五、UIViewController(视图控制器)

1、自己写的viewcontrol类也可以实例一个对象,如果该类上面有按钮或label则对象上也有相应控件

2、UIViewController实例的对象不能设置坐标和大小,它总是充满屏幕。


六、UINavigationController(导航控制器)

//初始化导航控制器

    UINavigationController *navControl=[[UINavigationController alloc]initWithRootViewController:viewControl];

    

    //将一个新的页面在导航栈中显示出来, 入栈、压栈

    //所有已经在导航控制器管理下的页面(UIViewController)都可以通过一个navigationController的属性访问它所在的导航控制器

    [self.navigationController pushViewController:viewControl3 animated:YES];


    //放回到导航控制器的上一个页面

    [self.navigationController popViewControllerAnimated:YES];

    

七、总结
大部分控件都有相同的属性。



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
牙科就诊管理系统利用当下成熟完善的SSM框架,使用跨平台的可开发大型商业网站的Java语言,以及最受欢迎的RDBMS应用软件之一的Mysql数据库进行程序开发。实现了用户在线查看数据。管理员管理病例管理、字典管理、公告管理、药单管理、药品管理、药品收藏管理、药品评价管理、药品订单管理、牙医管理、牙医收藏管理、牙医评价管理、牙医挂号管理、用户管理、管理员管理等功能。牙科就诊管理系统的开发根据操作人员需要设计的界面简洁美观,在功能模块布局上跟同类型网站保持一致,程序在实现基本要求功能时,也为数据信息面临的安全问题提供了一些实用的解决方案。可以说该程序在帮助管理者高效率地处理工作事务的同时,也实现了数据信息的整体化,规范化与自动化。 管理员在后台主要管理病例管理、字典管理、公告管理、药单管理、药品管理、药品收藏管理、药品评价管理、药品订单管理、牙医管理、牙医收藏管理、牙医评价管理、牙医挂号管理、用户管理、管理员管理等。 牙医列表页面,此页面提供给管理员的功能有:查看牙医、新增牙医、修改牙医、删除牙医等。公告信息管理页面提供的功能操作有:新增公告,修改公告,删除公告操作。公告类型管理页面显示所有公告类型,在此页面既可以让管理员添加新的公告信息类型,也能对已有的公告类型信息执行编辑更新,失效的公告类型信息也能让管理员快速删除。药品管理页面,此页面提供给管理员的功能有:新增药品,修改药品,删除药品。药品类型管理页面,此页面提供给管理员的功能有:新增药品类型,修改药品类型,删除药品类型。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值