iOS 广告自动转化
来源:互联网 发布:魔力怀旧宠物满档数据 编辑:程序博客网 时间:2024/05/09 01:14
// ViewController.m
// ScrollView
//
// Created by wuweilong on 14/11/8.
// Copyright (c) 2014年 com.wuweilong.cn. All rights reserved.
//
#define HEIGHT ([[UIScreen mainScreen].bounds.size.height])
#define WIDTH ([[UIScreen mainScreen].bounds.size.width])
#define PAGENUM 5
#import "ViewController.h"
@interface ViewController (){
}
@end
@implementation ViewController
@synthesize imagescrollView,page;
//NSInteger timeCount = 0;
- (void)viewDidLoad {
[superviewDidLoad];
self.imagescrollView = [[UIScrollViewalloc]initWithFrame:CGRectMake(0.0f, 20.0f,320, 90.0f)];
imagescrollView.contentSize =CGSizeMake(PAGENUM * 320,imagescrollView.frame.size.height);
imagescrollView.pagingEnabled =YES;
imagescrollView.showsHorizontalScrollIndicator =NO;
imagescrollView.delegate =self;
int i = 0 ;
for ( i = 0; i < PAGENUM; i++) {
NSString *fileName = [NSStringstringWithFormat:@"%d.png",i+1];
UIButton *imageButton = [[UIButtonalloc]initWithFrame:CGRectMake(i * 320.0f,0,320.0f,90.0f)];
[imageButton setBackgroundImage:[UIImageimageNamed:fileName] forState:UIControlStateNormal];
imageButton.tag = 900 + i;
[imagescrollViewaddSubview:imageButton];
}
[self.viewaddSubview:self.imagescrollView];
// [self.view addSubview:self.page];
self.page = [[UIPageControlalloc]init];
self.page.frame =CGRectMake(100, 50, 100, 20);
self.page.center =CGPointMake(100, 300);
self.page.numberOfPages =PAGENUM;
self.page.currentPage = 0;
[self.viewaddSubview:self.page];
[page addTarget:selfaction:@selector(pageTurn:)forControlEvents:UIControlEventValueChanged];
[NSTimer scheduledTimerWithTimeInterval:3 target:selfselector:@selector(pageChange)userInfo:nilrepeats:YES];
}
-(void)pageChange{
timeCount ++;
if (timeCount ==PAGENUM) {
timeCount = 0 ;
}
self.page.currentPage =timeCount;
[imagescrollViewscrollRectToVisible:CGRectMake(timeCount *320, 0, 320, 90)animated:YES];
}
-(void)pageTurn:(UIPageControl *)aPageControl{
int whichPage = aPageControl.currentPage;
[UIView beginAnimations:nilcontext:nil];
[UIView setAnimationDuration:3.0f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseIn];
[imagescrollViewsetContentOffset:CGPointMake(320.0f *whichPage, 0.0f)];
[UIView commitAnimations];
}
- (void)didReceiveMemoryWarning {
[superdidReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
- iOS 广告自动转化
- iOS 添加滚动scrollView自动滚动广告页
- IOS 广告页(点击广告图片自动跳转到WebView)
- iOS-自动将OC转化为Swift语言(iSwift)
- 广告自动滚动
- Android 自动广告轮播图
- 自动生成广告代码
- iOS开发系列之常用自定义控件开发集—自动广告墙图片控件开发
- IOS实现自动循环滚动广告--ScrollView的优化和封装
- IOS实现自动循环滚动广告--ScrollView的优化和封装
- 【广告算法工程师入门 2】广告检索和转化流程
- java数据类型自动转化
- Java<类型自动转化>
- UIWebView去除广告以及字符串的转化
- iOS:集成iAd广告
- ios 广告平台
- IOS 关闭广告
- IOS如何植入广告
- 安装火蜘蛛采集器,采集天猫新百伦旗舰店商品数据上传到微信
- 利用MySQL存储过程分割字符串
- 十六进制简单运算
- 成功转型软件攻城师
- NYOJ 218 Dinner
- iOS 广告自动转化
- CCTableView用法总结
- QVector QList QMap 复杂容器使用
- win7 IIS Web.config节点锁定问题
- opencv人脸识别,jni中Bitmap转BGR格式
- 满足实时显示和取消Toast信息的Toast工具类
- 机制与策略
- Microsoft Lync 个人理解
- 马尔可夫逻辑网络