ios第3天的气泡作业

来源:互联网 发布:软件测试的基本技能 编辑:程序博客网 时间:2024/04/27 14:39

ios第3天的气泡作业

////  ViewController.m//  UIIMage////  Created by 王磊 on 16/1/20.//  Copyright © 2016年 wangleilei. All rights reserved.//#import "ViewController.h"@interface ViewController ()- (IBAction)stop:(id)sender;- (IBAction)play:(id)sender;@property(nonatomic,strong) UIImageView* imageView;@end@implementation ViewController- (void)viewDidLoad {    [super viewDidLoad];    NSDictionary* dict = @{                           NSFontAttributeName:[UIFont systemFontOfSize:30],                           NSForegroundColorAttributeName:[UIColor blueColor]                           };    UIEdgeInsets insets = UIEdgeInsetsMake(56, 35, 23, 25);    //    UIView* v = [[UIView alloc]init];    UIImage* image = [UIImage imageNamed:@"qipao"];    UIImageView* imageView = [[UIImageView alloc]init ];    //    CGRectMake(20 ,40 , self.view.frame.size.width-40, 200)];    //    image.size = [szietofit]    image = [image resizableImageWithCapInsets:insets resizingMode:UIImageResizingModeStretch];    imageView.image = image;    //    lable.backgroundColor = [UIColor colorWithPatternImage:image];    UILabel* lable = [[UILabel alloc]init];    NSString* string = @"宇宙黑客黑客宇宙你是谁你在哪里我找不到 =====你是中国门中国国旗宇宙黑客 ����";    lable.text = string;    lable.numberOfLines = 0;    lable.font = [UIFont systemFontOfSize:30];    //    lable.backgroundColor = [UIColor orangeColor];    //    lable.frame = imageView.frame;    //    lable.frame =  CGRectMake(10, 10, 10, 10);    CGSize size = [string boundingRectWithSize:CGSizeMake(self.view.frame.size.width - 40, MAXFLOAT) options:NSStringDrawingUsesLineFragmentOrigin attributes:dict context:nil].size;    lable.frame  = CGRectMake(20, 20, size.width, size.height);    imageView.frame  = CGRectMake(0, 20, size.width+40, size.height);    //    lable.center = imageView.center = self.view.center;    [self.view addSubview:imageView ];    [self.view addSubview:lable ];}- (void)didReceiveMemoryWarning {    [super didReceiveMemoryWarning];    // Dispose of any resources that can be recreated.}- (IBAction)stop:(id)sender {    self.imageView.animationRepeatCount = 0;    [self.imageView startAnimating];}- (IBAction)play:(id)sender {    self.imageView.animationRepeatCount = 1;    [self.imageView stopAnimating];}@end

下面是程序执行后的结果

0 0