V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  aminly  ›  全部回复第 1 页 / 共 1 页
回复总数  1
2015-08-05 12:42:32 +08:00
回复了 xiaobetty 创建的主题 推广 晒出你最蠢的一段代码,送 Cherry 鼠标垫
for (int i =0 ; i<4; i++) {
UIButton *btn =[[UIButton alloc]init];
float ppx = ((kMainScreenWidth-15-40)-55)/4;

UILabel *title =[[UILabel alloc]init];
[title setFont:[UIFont systemFontOfSize:14]];
[title setTextColor:[UIColor colorWithHexString:@"#343434"]];

switch (i) {
case 0:

[btn setFrame:CGRectMake(15, self.LabelTitle.frame.origin.y+40,40,40)];
[title setFrame: CGRectMake(btn.frame.origin.x+btn.frame.size.width/2-12,btn.origin.y+btn.frame.size.width,24,20)];
[btn setBackgroundImage:[UIImage imageNamed:@"icon-qq"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(QQshareBtnClick:) forControlEvents:UIControlEventTouchUpInside];
title.text = @"QQ";
break;

case 1:
[btn setFrame:CGRectMake(ppx+55-9, self.LabelTitle.frame.origin.y+40,40,40)];
[title setFrame: CGRectMake(btn.frame.origin.x+btn.frame.size.width/2-15,btn.origin.y+btn.frame.size.width,30,20)];


[btn setBackgroundImage:[UIImage imageNamed:@"icon-msg"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(MSGshareBtnClick:) forControlEvents:UIControlEventTouchUpInside];
title.text = @"短息";
break;
case 2:
[btn setFrame:CGRectMake(kMainScreenWidth/2+ppx-40+9, self.LabelTitle.frame.origin.y+40,40,40)];
[title setFrame: CGRectMake(btn.frame.origin.x+btn.frame.size.width/2-15,btn.origin.y+btn.frame.size.width,30,20)];


[btn setBackgroundImage:[UIImage imageNamed:@"icon-wechat"] forState:UIControlStateNormal];
[btn addTarget:self action:@selector(WeChatshareBtnClick:) forControlEvents:UIControlEventTouchUpInside];
title.text = @"微信";
break;
case 3:
[btn setBackgroundImage:[UIImage imageNamed:@"icon-friendc"] forState:UIControlStateNormal];
[btn setFrame:CGRectMake(kMainScreenWidth-15-40, self.LabelTitle.frame.origin.y+40,40,40)];

[btn addTarget:self action:@selector(FriendCshareBtnClick:) forControlEvents:UIControlEventTouchUpInside];
title.text = @"朋友圈";
[title setFrame: CGRectMake(btn.frame.origin.x+btn.frame.size.width/2-22,btn.origin.y+btn.frame.size.width,45,20)];
break;
}

[self.shareView addSubview:title];
[self.shareView addSubview:btn];
}
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   892 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 21:40 · PVG 05:40 · LAX 13:40 · JFK 16:40
Developed with CodeLauncher
♥ Do have faith in what you're doing.