美文网首页
发表评论页面(星级,文本,图片)一

发表评论页面(星级,文本,图片)一

作者: 小柴2011 | 来源:发表于2017-04-26 16:40 被阅读50次

这个页面相对内容较多一些,我分两块来记述。第一块是星级和文本的实现。第二块详细记述图片的处理。

实现的效果如下:

星级用的网上的一个第三方的类文件CWStarRateView,可以实现各种评级样式,无论是星星或者是心。只需更换图片。可以选择整心输入或者半心输入。

//

self.starRateView= [[CWStarRateView alloc]initWithFrame:CGRectMake(100,65,130,18)numberOfStars:5];

self.starRateView.scorePercent=1.0;

self.starRateView.allowIncompleteStar=NO;

self.starRateView.hasAnimation=YES;

self.starRateView.delegate=self;

[self.bottomViewaddSubview:self.starRateView];

//CWStarRateView代理方法

- (void)starRateView:(CWStarRateView*)starRateView scroePercentDidChange:(CGFloat)newScorePercent

{

NSLog(@"%f", newScorePercent);

self.score= [NSStringstringWithFormat:@"%f", newScorePercent *5];

}

//以下是UITextView

_textView= [[UITextView alloc]initWithFrame:CGRectMake(15,105,kScreenWidth-30,140)]; 

_textView.editable=YES;

_textView.delegate=self;

_textView.text=@"写下消费体验来帮助其他小伙伴(最多200字)";

_textView.textColor=RGB(204,204,204);

_textView.font= [UIFontsystemFontOfSize:15];

_textView.scrollEnabled=YES;

_textView.backgroundColor=RGB(244,244,244);

[self.bottomViewaddSubview:_textView];

self.automaticallyAdjustsScrollViewInsets=NO;

_textView.keyboardType=UIKeyboardTypeDefault;

//当开始输入 清空UITextView

- (void)textViewDidBeginEditing:(UITextView*)textView

{

textView.text=nil;

}

相关文章

网友评论

      本文标题:发表评论页面(星级,文本,图片)一

      本文链接:https://www.haomeiwen.com/subject/tjaizttx.html