当前位置: 首页 > news >正文

做网站的收益在哪/王通seo教程

做网站的收益在哪,王通seo教程,电商网站建设优缺点,深圳网站程序开发制作iPhone中没有提供进度条控件&#xff0c;但是可以通过UIView下自己开发&#xff0c;下面的代码是我根据网上的代码改造的&#xff0c;可以做出上面这样的进度条&#xff0c;样子还是不错的。 .h文件 #import <UIKit/UIKit.h> interface BYProgressBarObject : NSObject…
iOS进度条 自定义 iPhone中没有提供进度条控件,但是可以通过UIView下自己开发,下面的代码是我根据网上的代码改造的,可以做出上面这样的进度条,样子还是不错的。   .h文件
#import <UIKit/UIKit.h>
@interface BYProgressBarObject : NSObject
{float _value;//进度条的数值 0-1NSString * _labelText;//进度条上显示的文字int _level;//所处的等级 2,1,0
}
@property(nonatomic,assign) float value;
@property(nonatomic,copy) NSString * labelText;
@property(nonatomic,assign) int level;
@end
@interface BYProgressBar : UIView 
{float minValue, maxValue;float lowValue,highValue;float currentValue;UIColor *lineColor, *progressRemainingColor, *progressColor;NSString * _displayString;
}
@property (readwrite) float minValue, maxValue, currentValue,lowValue,highValue;
@property (nonatomic, retain) UIColor *lineColor, *progressRemainingColor, *progressColor;
-(void)setNewRect:(CGRect)newFrame;
-(void)updateProgress:(float)valueLabelString:(NSString *) labelStringLevel:(int) level;
-(void)updateProgress:(BYProgressBarObject *) progressObject;
@end
.m文件
#import "BYProgressBar.h"
#import "Skin.h"
@implementation BYProgressBarObject
@synthesize value=_value,level=_level,labelText=_labelText;
@end
@implementation BYProgressBar
@synthesize minValue, maxValue, currentValue,lowValue,highValue;
@synthesize lineColor, progressRemainingColor, progressColor;
- (id)initWithFrame:(CGRect)frame 
{if (self = [super initWithFrame:frame]){minValue = 0;maxValue = 1;currentValue = 0;self.backgroundColor = [UIColor clearColor];lineColor = [[UIColor whiteColor] retain];progressColor = [[UIColor darkGrayColor] retain];progressRemainingColor = [ProgreeBar_BackColor retain];//[[UIColor lightGrayColor] retain];}return self;
}
- (void)drawRect:(CGRect)rect
{CGContextRef context = UIGraphicsGetCurrentContext();CGContextSetLineWidth(context, 1);CGContextSetStrokeColorWithColor(context,[lineColor CGColor]);CGContextSetFillColorWithColor(context, [[progressRemainingColor colorWithAlphaComponent:.7] CGColor]);float radius = (rect.size.height / 2) - 2;CGContextMoveToPoint(context, 2, rect.size.height/2);
CGContextAddArcToPoint(context, 2, 2, radius + 2, 2, radius);CGContextAddLineToPoint(context, rect.size.width - radius - 2, 2);CGContextAddArcToPoint(context, rect.size.width - 2, 2, rect.size.width - 2, rect.size.height / 2, radius);CGContextFillPath(context);CGContextSetFillColorWithColor(context, [progressRemainingColor CGColor]);
CGContextMoveToPoint(context, rect.size.width - 2, rect.size.height/2);CGContextAddArcToPoint(context, rect.size.width - 2, rect.size.height - 2, rect.size.width - radius - 2, rect.size.height - 2, radius);CGContextAddLineToPoint(context, radius + 2, rect.size.height - 2);CGContextAddArcToPoint(context, 2, rect.size.height - 2, 2, rect.size.height/2, radius);CGContextFillPath(context);CGContextMoveToPoint(context, 2, rect.size.height/2);CGContextAddArcToPoint(context, 2, 2, radius + 2, 2, radius);CGContextAddLineToPoint(context, rect.size.width - radius - 2, 2);CGContextAddArcToPoint(context, rect.size.width - 2, 2, rect.size.width - 2, rect.size.height / 2, radius);CGContextAddArcToPoint(context, rect.size.width - 2, rect.size.height - 2, rect.size.width - radius - 2, rect.size.height - 2, radius);CGContextAddLineToPoint(context, radius + 2, rect.size.height - 2);CGContextAddArcToPoint(context, 2, rect.size.height - 2, 2, rect.size.height/2, radius);CGContextStrokePath(context);CGContextSetFillColorWithColor(context, [[progressColor colorWithAlphaComponent:.78] CGColor]);
radius = radius - 2;CGContextMoveToPoint(context, 4, rect.size.height/2);float amount = (currentValue/(maxValue - minValue)) * (rect.size.width);if (amount >= radius + 4 && amount <= (rect.size.width - radius - 4)) {CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius);CGContextAddLineToPoint(context, amount, 4);//CGContextAddLineToPoint(context, amount, radius + 4);CGContextAddArcToPoint(context, amount + radius + 4, 4, amount + radius + 4, rect.size.height/2, radius);
CGContextFillPath(context);CGContextSetFillColorWithColor(context, [progressColor CGColor]);CGContextMoveToPoint(context, 4, rect.size.height/2);CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);CGContextAddLineToPoint(context, amount, rect.size.height - 4);CGContextAddArcToPoint(context, amount + radius + 4, rect.size.height - 4, amount + radius + 4, rect.size.height/2, radius);//CGContextAddLineToPoint(context, amount, radius + 4);CGContextFillPath(context);} else if (amount > radius + 4) {CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius);CGContextAddLineToPoint(context, rect.size.width - radius - 4, 4);CGContextAddArcToPoint(context, rect.size.width - 4, 4, rect.size.width - 4, rect.size.height/2, radius);CGContextFillPath(context);CGContextSetFillColorWithColor(context, [progressColor CGColor]);CGContextMoveToPoint(context, 4, rect.size.height/2);CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);CGContextAddLineToPoint(context, rect.size.width - radius - 4, rect.size.height - 4);CGContextAddArcToPoint(context, rect.size.width - 4, rect.size.height - 4, rect.size.width - 4, rect.size.height/2, radius);CGContextFillPath(context);} else if (amount < radius + 4 && amount > 0) {CGContextAddArcToPoint(context, 4, 4, radius + 4, 4, radius);CGContextAddLineToPoint(context, radius + 4, rect.size.height/2);CGContextFillPath(context);CGContextSetFillColorWithColor(context, [progressColor CGColor]);CGContextMoveToPoint(context, 4, rect.size.height/2);CGContextAddArcToPoint(context, 4, rect.size.height - 4, radius + 4, rect.size.height - 4, radius);CGContextAddLineToPoint(context, radius + 4, rect.size.height/2);CGContextFillPath(context);}//显示文字if (_displayString ) {//画每个块上的文字CGContextSetLineWidth(context, 1.0); //设置矩形填充颜色:白色 CGContextSetRGBFillColor (context, 255.0/255.0, 255.0/255.0,255.0/255.0, 1.0); //设置字体 UIFont * font = [UIFont systemFontOfSize:14];CGSize labelSize = [_displayString sizeWithFont:fontconstrainedToSize:rect.sizelineBreakMode:UILineBreakModeCharacterWrap];//在指定的矩形区域内画文字CGRect textRect=CGRectMake(0, (rect.size.height-labelSize.height)/2, rect.size.width, rect.size.height);[_displayString drawInRect:textRect withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];}
}
-(void)setNewRect:(CGRect)newFrame 
{self.frame = newFrame;[self setNeedsDisplay];
}
-(void)setMinValue:(float)newMin
{minValue = newMin;[self setNeedsDisplay];
}
-(void)setMaxValue:(float)newMax
{maxValue = newMax;[self setNeedsDisplay];
}
-(void)setCurrentValue:(float)newValue
{currentValue = newValue;[self setNeedsDisplay];
}
-(void)setLowValue:(float)newValue
{lowValue = newValue;[self setNeedsDisplay];
}
-(void)setHighValue:(float)newValue
{highValue = newValue;[self setNeedsDisplay];
}
-(void)setLineColor:(UIColor *)newColor
{[newColor retain];[lineColor release];lineColor = newColor;[self setNeedsDisplay];
}
-(void)setProgressColor:(UIColor *)newColor
{[newColor retain];[progressColor release];progressColor = newColor;[self setNeedsDisplay];
}
-(void)setProgressRemainingColor:(UIColor *)newColor
{[newColor retain];[progressRemainingColor release];progressRemainingColor = newColor;[self setNeedsDisplay];
}
- (void)dealloc
{[lineColor release];[progressColor release];[progressRemainingColor release];[super dealloc];
}
-(void)updateProgress:(BYProgressBarObject *) progressObject
{[self updateProgress:progressObject.value LabelString:progressObject.labelText Level:progressObject.level];
}
-(void)updateProgress:(float)valueLabelString:(NSString *) labelStringLevel:(int) level
{currentValue = value;UIColor * newColor=nil;switch (level) {case 0://低newColor=Status_Bar_Low_Orange;break;case 1://中newColor=Status_Bar_Middle_Yello;break;case 2://高newColor=Status_Bar_High_Green;break;default:break;}[newColor retain];[progressColor release];progressColor = newColor;_displayString=labelString;[self setNeedsDisplay];
}
@end
 

转载于:https://www.cnblogs.com/liuxingzi/archive/2012/12/04/3404287.html

http://www.jmfq.cn/news/5180167.html

相关文章:

  • 武汉做网站哪里好/优化疫情防控措施
  • 杭州企业网站建设/知乎关键词排名
  • 平度网站建设ld4/推介网
  • 阿里妈妈 该网站的域名已经被其他人绑定/seo网站推广经理
  • 面试建设单位在哪个网站/网络推广工作内容
  • 万网服务器网站建设/网站友链查询源码
  • 阜阳网站建设价格/竞价排名点击器
  • 苏州市建设安全监督局网站/排名优化方案
  • 襄州区城乡建设局网站/江门seo
  • 芸志建站怎么建立网站/网络公关公司收费
  • 设计网站会员/海外营销
  • 餐饮企业网站建设方案书/sem竞价推广怎么做
  • 网站使用说明书/免费的行情网站app
  • 网站建设标书模板下载/ks免费刷粉网站推广
  • 深圳做棋牌网站建设找哪家公司好/百度推广免费
  • 企业网站推广案例/一个产品的市场营销策划方案
  • 做3d任务的网站/成都网站seo外包
  • 怎么让网站排名上去/电商产品推广方案
  • 做英文网站价格/百度竞价渠道代理商
  • 无锡网站建设 首选众诺/百度极速版app下载安装挣钱
  • 网站建设哪里比较好/免费网页制作网站
  • 推荐完善政府网站建设/深圳全网推广
  • 开源展示型网站/优化课程设置
  • php个人网站源码带音乐/网站设计师
  • 家居企业网站建设流程/品牌运营具体做什么
  • 网站建设框架/代写文章价格表
  • 怎样做购物网站/域名查询服务器
  • 怎样找到黄页网站/b站推广怎么买
  • 如何利用某个软件做一个网站/网络营销主要是学什么的
  • 代还信用卡网站建设/公关