| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- //
- // ULGView.m
- // BuguLive
- //
- // Created by fanwe2014 on 2016/12/10.
- // Copyright © 2016年 xfg. All rights reserved.
- //
- #import "ULGView.h"
- #import "AppleIDManager.h"
- @implementation ULGView
- - (id)initWithFrame:(CGRect)frame Array:(NSArray *)array
- {
- self = [super initWithFrame:frame];
- if (self)
- {
- [self creatViewWithArray:array];
- }
- return self;
- }
- - (void)creatViewWithArray:(NSArray *)array
- {
- CGFloat Width = (kScreenW - array.count*47)/(array.count+1);
- for (int i = 0; i < array.count; i ++)
- {
- UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
- //[button setImage:[UIImage imageNamed:array[i]] forState:UIControlStateNormal];
- [self creatButtonViewWithButton:button andCount:[array[i] intValue]];
- button.frame =CGRectMake((Width+47)*i+Width, 0, 47, 47);
- button.tag = 100+[array[i] intValue];
- [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
- button.layer.cornerRadius = button.frame.size.width/2;
-
-
- // manager.window = [UIApplication sharedApplication].keyWindow;
-
-
-
-
- [self addSubview:button];
- }
- }
- - (void)creatButtonViewWithButton:(UIButton *)button andCount:(int)count
- {
- switch (count)
- {
- case 1:
- [button setImage:[UIImage imageNamed:@"lg_qq"] forState:UIControlStateNormal];
- break;
- case 2:
- [button setImage:[UIImage imageNamed:@"lg_weixin"] forState:UIControlStateNormal];
- break;
- case 3:
- [button setImage:[UIImage imageNamed:@"lg_xinlangweibo"] forState:UIControlStateNormal];
- break;
- case 4:
- [button setImage:[UIImage imageNamed:@"lg_shouji"] forState:UIControlStateNormal];
- break;
- case 5:
- [button setImage:[UIImage imageNamed:@"icon_login_fb"] forState:UIControlStateNormal];
- break;
- case 6:
- [button setImage:[UIImage imageNamed:@"icon_login_fb"] forState:UIControlStateNormal];
- break;
- case 8:
- [button setImage:[UIImage imageNamed:@"icon_login_fb"] forState:UIControlStateNormal];
- break;
-
- default:
- break;
- }
- }
- - (void)buttonClick:(UIButton *)button
- {
- if (self.LDelegate)
- {
- if ([self.LDelegate respondsToSelector:@selector(enterLoginWithCount:)])
- {
- [self.LDelegate enterLoginWithCount:(int)(button.tag-100)];
- }
- }
- }
- @end
|