您的位置:首页 > 产品设计 > UI/UE

iOS入门之UIButton/ViewController/UIImage

2013-10-11 20:59 239 查看
UIButton
 按钮

UIButton * bt1=[UIButton buttonWithType:UIButtonTypeRoundedRect];
[bt1 setTitle:@"ok" forState:UIControlStateNormal];
[window addSubview:bt1];
对象                委托对象                             委托方法 
                                               对象事件
[bt1 addTarget:self action:@selector(doclick) forControlEvents:UIControlEventTouchUpInside];

*******************************************************************

在窗口中添加视图控制器

    self.m_rootViewCtl=[[MyViewControlleralloc]initWithNibName:nilbundle:nil];
    self.window.rootViewController=m_rootViewCtl;相当于-》
[self.windowaddSubview:m_rootViewCtl.view];

    [self.windowmakeKeyAndVisible];

**************************************************

添加图片

self->m_img01=[UIImage imageNamed:@"rank_icon_7.png"];

self->m_img02=[UIImage imageNamed:@"rank_icon_8"];

    

m_im01=[[UIImageView alloc]initWithImage:self->m_img01];//分配内存空间

m_im01.frame = CGRectMake(60, 100, 80, 80);//设置坐标

m_im01.userInteractionEnabled = YES;

[self.view addSubview:m_im01];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息