本帖最后由 竹林风 于 2019-1-7 17:25 编辑
导读
效果:
代码:
[Objective-C] 纯文本查看 复制代码 #import "HomePageVC.h"
@interface HomePageVC (){
NSArray *aryImage;
}
@end
@implementation HomePageVC
- (void)viewDidLoad {
[super viewDidLoad];
[self hiddenBackBarButtonItems];
UILabel *lbl = [MTools creatLblWithFont:kFont(15) TextColor:kColor(orangeColor)];
lbl.frame = CGRectMake(20, 90, ScreenWidth - 40, 30);
lbl.text = @"my Style";
[self.view addSubview:lbl];
aryImage = @[@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545718143449&di=b889c87c3f2113d0b6b432c64b7f0083&imgtype=0&src=http%3A%2F%2Fbbs.crsky.com%2F1236983883%2FMon_1010%2F33_123062_9ed21725e34b436.jpg"
,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545718143450&di=6ff9b17f8bd94134757823290fed6c4a&imgtype=0&src=http%3A%2F%2Fs1.sinaimg.cn%2Flarge%2F006obi0izy7fbFW0aaP87"
,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993908&di=3d69513ba604581d6f7ecd5a3d95af01&imgtype=0&src=http%3A%2F%2Fwx2.sinaimg.cn%2Flarge%2F7f6b590cgy1fh45ymrs2yj20yi0n045s.jpg"
,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993920&di=069d36606fd5c931f0ccacf4eaf2deb1&imgtype=0&src=http%3A%2F%2F5b0988e595225.cdn.sohucs.com%2Fimages%2F20181108%2F107d1a026d13432888d2c63874ade13f.jpeg"
,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993921&di=bddf049946052e7c2c47e7442bd8ff58&imgtype=0&src=http%3A%2F%2Fimg.xsee.cc%2Fupload%2Falbum%2F2015%2F08%2F29%2Ff59fa4f4-ff7c-449d-8a6c-4e98258231c3-1200x671.jpg"
,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993923&di=3d41f4448f1b109ba9f9db2f862164ae&imgtype=0&src=http%3A%2F%2Ftu.simei8.com%3A7788%2Fpic126%2F12605-2.jpg",
@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993924&di=8b5e5fe04a79b9c364b18dc658cde3d2&imgtype=0&src=http%3A%2F%2Fpic.rmb.bdstatic.com%2F92681f91f9004125caf7d84dbbfd1771.jpeg",
@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993925&di=8deba72d20e3830417ac69c4d7f17233&imgtype=0&src=http%3A%2F%2Fwww.shangbiaomyd.com%2Fuploads%2FCuteEditor%2F20150130144058313.jpg"
,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993925&di=f413c95a8217490f4da62622c389bb5d&imgtype=0&src=http%3A%2F%2Fb-ssl.duitang.com%2Fuploads%2Fblog%2F201403%2F13%2F20140313101142_NcBJt.jpeg"
,@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1545717993928&di=02cd4e9a6ac76045beaffba7ef2b4663&imgtype=0&src=http%3A%2F%2Fattachments.gfan.com%2Fforum%2Fattachments2%2Fday_110907%2F1109071959e3f9a92e0283af86.jpg"];
for (int i = 0; i < 6; i ++) {
UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(20 + (100 + 10)*(i%3), lbl.frameBottom + 10 + (100 + 10)*(i/3), 100, 100)];
[imageView sd_setImageWithURL:kURL(aryImage[i]) placeholderImage:nil];
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.clipsToBounds = YES;
imageView.tag = i;
[imageView addTapGestureWithBlock:^(id sender) {
[self didBrowserImages:(UIImageView *)sender];
}];
[self.view addSubview:imageView];
}
}
-(void)didBrowserImages:(UIImageView *)sender{
[[Global shareGlobal] browserImageWithArray:aryImage CurrentImageView:sender];
}
附件:
浏览图片.zip
(693.52 KB, 下载次数: 0)
|