Initial commit
This commit is contained in:
Binary file not shown.
+14
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// IFishActivityCateView.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/5/12.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface IFishActivityCateView : UIView
|
||||
-(void)activityViewaddTitle:(NSString *)title;
|
||||
|
||||
@end
|
||||
+134
@@ -0,0 +1,134 @@
|
||||
//
|
||||
// IFishActivityCateView.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/5/12.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IFishActivityCateView.h"
|
||||
@interface IFishActivityCateView ()
|
||||
@property (nonatomic,strong) UILabel *textLabe;
|
||||
@property (nonatomic,strong) UIView *circleView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation IFishActivityCateView
|
||||
|
||||
-(id)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
|
||||
[self creatSub];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)awakeFromNib{
|
||||
[super awakeFromNib];
|
||||
[self creatSub];
|
||||
}
|
||||
|
||||
-(void)layoutSubviews{
|
||||
|
||||
[super layoutSubviews];
|
||||
|
||||
}
|
||||
|
||||
-(void)creatSub{
|
||||
|
||||
if (!_circleView) {
|
||||
_circleView = [[UIView alloc] init];
|
||||
|
||||
[self addSubview:_circleView];
|
||||
}
|
||||
if (!_textLabe) {
|
||||
_textLabe = [[UILabel alloc] init];
|
||||
_textLabe.textAlignment = NSTextAlignmentLeft;
|
||||
_textLabe.textColor = [UIColor whiteColor];
|
||||
_textLabe.font = [UIFont systemFontOfSize:12];
|
||||
[self addSubview:_textLabe];
|
||||
}
|
||||
|
||||
UIColor *color = [self loadrandomColor];
|
||||
_textLabe.backgroundColor = color;
|
||||
_circleView.backgroundColor = color;
|
||||
|
||||
}
|
||||
|
||||
-(UIColor *)loadrandomColor
|
||||
{
|
||||
UIColor *color = nil;
|
||||
int i = (arc4random()%4) + 1;// 设置随机色
|
||||
switch (i) {
|
||||
case 1:
|
||||
{
|
||||
color = RGB(113, 219, 254);
|
||||
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
color = RGB(255, 117, 156);
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
color = RGB(255, 175, 117);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
{
|
||||
color = RGB(117, 198, 255);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
|
||||
-(void)activityViewaddTitle:(NSString *)title
|
||||
{
|
||||
_textLabe.text = title;
|
||||
|
||||
CGFloat strW = [self widthForString:title fontSize:12 andHeight:self.frame.size.height];
|
||||
CGFloat labeW= strW + 15;
|
||||
_textLabe.frame = CGRectMake(self.frame.size.width-labeW, 0, labeW, self.frame.size.height);
|
||||
_circleView.frame = CGRectMake(self.frame.size.width-labeW - self.frame.size.height/2,0, self.frame.size.height, self.frame.size.height);
|
||||
[self bringSubviewToFront:_textLabe];
|
||||
_circleView.layer.masksToBounds = YES;
|
||||
_circleView.layer.cornerRadius = self.frame.size.height/2;
|
||||
|
||||
}
|
||||
|
||||
#pragma -mark -functions
|
||||
|
||||
//获取字符串的宽度
|
||||
-(float) widthForString:(NSString *)value fontSize:(float)fontSize andHeight:(float)height
|
||||
{
|
||||
|
||||
CGRect rect = [value boundingRectWithSize:CGSizeMake(CGFLOAT_MAX, height) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]} context:nil];
|
||||
|
||||
CGSize sizeToFit = rect.size;
|
||||
|
||||
return sizeToFit.width;
|
||||
|
||||
}
|
||||
|
||||
//获得字符串的高度
|
||||
-(float) heightForString:(NSString *)value fontSize:(float)fontSize andWidth:(float)width
|
||||
{
|
||||
|
||||
CGRect rect = [value boundingRectWithSize:CGSizeMake(width, CGFLOAT_MAX) options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:fontSize]} context:nil];
|
||||
CGSize sizeToFit = rect.size;
|
||||
return sizeToFit.height;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// IFishUserActivityListCell.h
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/5/12.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "IFishActivityCateView.h"
|
||||
#import "IFishUserActivityData.h"
|
||||
@interface IFishUserActivityListCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *userImg;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *levelLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameLab;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timeLabe;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *descLabe;
|
||||
@property (weak, nonatomic) IBOutlet IFishActivityCateView *noteView;
|
||||
-(void)loadDataWith:(IFishUserActivityData*)data typeArr:(NSMutableArray *)typArr;
|
||||
@end
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// IFishUserActivityListCell.m
|
||||
// Ifish
|
||||
//
|
||||
// Created by imac on 2017/5/12.
|
||||
// Copyright © 2017年 lianlian. All rights reserved.
|
||||
//
|
||||
|
||||
#import "IFishUserActivityListCell.h"
|
||||
#import "UIImageView+WebCache.h"
|
||||
#import "FishActivityData.h"
|
||||
@implementation IFishUserActivityListCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
[super awakeFromNib];
|
||||
// Initialization code
|
||||
self.userImg.layer.masksToBounds = YES;
|
||||
self.userImg.layer.cornerRadius = self.userImg.frame.size.width/2;
|
||||
|
||||
}
|
||||
|
||||
-(void)layoutSubviews{
|
||||
|
||||
|
||||
}
|
||||
|
||||
-(void)loadDataWith:(IFishUserActivityData*)data typeArr:(NSMutableArray *)typArr{
|
||||
|
||||
|
||||
NSString*strUrl=[NSString stringWithFormat:@"%@%@",kGetIconUrl,data.userImg];
|
||||
[self.userImg sd_setImageWithURL:[NSURL URLWithString:strUrl] placeholderImage:[UIImage imageNamed:@"live_hold.png"]];
|
||||
self.levelLabel.text = [NSString stringWithFormat:@"LV%@",data.gradeNum];
|
||||
self.nameLab.text = data.nickName;
|
||||
NSString *dateStr = [NSString stringWithFormat:@"%@",data.createTime];
|
||||
NSDate *date = [dataContorl formatDateTime:dateStr];
|
||||
//NSLog(@"date***%@****",date);
|
||||
|
||||
NSString *riqi =[dataContorl getMonthAndDay:date];
|
||||
NSString *time = [dataContorl getHmWithDate:date];
|
||||
self.timeLabe.text = [NSString stringWithFormat:@"%@ %@",riqi,time];
|
||||
//self.timeLabe.text = data.createTime;
|
||||
for (FishActivityData *typ in typArr) {
|
||||
if ([data.activityType isEqualToString:typ.activityType]) {
|
||||
|
||||
self.descLabe.text = typ.typeDetail;
|
||||
|
||||
[self.noteView activityViewaddTitle:typ.typeTitle];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11762" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
|
||||
<device id="retina4_7" orientation="portrait">
|
||||
<adaptation id="fullscreen"/>
|
||||
</device>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11757"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="IFishUserActivityListCell" id="KGk-i7-Jjw" customClass="IFishUserActivityListCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="124"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="123"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="yCp-Pc-niT">
|
||||
<rect key="frame" x="15" y="19" width="43" height="43"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="43" id="K1h-6R-dgq"/>
|
||||
<constraint firstAttribute="width" constant="43" id="utS-Lc-5nb"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MC2-dj-tQV">
|
||||
<rect key="frame" x="15" y="70" width="43" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="43" id="O0H-Fu-MQP"/>
|
||||
<constraint firstAttribute="height" constant="21" id="spG-aM-uyY"/>
|
||||
</constraints>
|
||||
<attributedString key="attributedText">
|
||||
<fragment content="Label">
|
||||
<attributes>
|
||||
<color key="NSColor" red="1" green="0.87058823529411766" blue="0.34901960784313724" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<font key="NSFont" size="15" name="GillSans-BoldItalic"/>
|
||||
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
|
||||
</attributes>
|
||||
</fragment>
|
||||
</attributedString>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="j4H-3i-r5P">
|
||||
<rect key="frame" x="66" y="19" width="44" height="21"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="21" id="E4g-ow-Bbo"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="18"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="o4z-Rh-bJE">
|
||||
<rect key="frame" x="66" y="44" width="31" height="15"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="15" id="ehn-eA-OyR"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Rvn-dY-yD4" customClass="IFishActivityCateView">
|
||||
<rect key="frame" x="207" y="13" width="113" height="18"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="113" id="prU-qW-zDS"/>
|
||||
<constraint firstAttribute="height" constant="18" id="zt9-Kb-dri"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="3" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ncX-Ol-5UJ">
|
||||
<rect key="frame" x="66" y="75" width="230" height="16"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="MC2-dj-tQV" firstAttribute="top" secondItem="yCp-Pc-niT" secondAttribute="bottom" constant="8" id="3rn-Yu-isb"/>
|
||||
<constraint firstItem="o4z-Rh-bJE" firstAttribute="top" secondItem="j4H-3i-r5P" secondAttribute="bottom" constant="4" id="4bK-ON-pNb"/>
|
||||
<constraint firstItem="j4H-3i-r5P" firstAttribute="leading" secondItem="yCp-Pc-niT" secondAttribute="trailing" constant="8" id="6sP-lR-lDJ"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="ncX-Ol-5UJ" secondAttribute="trailing" constant="16" id="JDU-Um-Ioe"/>
|
||||
<constraint firstItem="yCp-Pc-niT" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="11" id="PiQ-ZO-35r"/>
|
||||
<constraint firstItem="j4H-3i-r5P" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="11" id="Tfx-OA-r8W"/>
|
||||
<constraint firstAttribute="trailingMargin" secondItem="Rvn-dY-yD4" secondAttribute="trailing" constant="-8" id="WEX-Zx-rtu"/>
|
||||
<constraint firstItem="ncX-Ol-5UJ" firstAttribute="top" secondItem="o4z-Rh-bJE" secondAttribute="bottom" constant="16" id="YSG-xm-deN"/>
|
||||
<constraint firstItem="ncX-Ol-5UJ" firstAttribute="leading" secondItem="yCp-Pc-niT" secondAttribute="trailing" constant="8" id="cUG-b4-oPR"/>
|
||||
<constraint firstItem="Rvn-dY-yD4" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="topMargin" constant="4.5" id="jMR-mB-VCL"/>
|
||||
<constraint firstItem="yCp-Pc-niT" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="7" id="nv5-dr-4tf"/>
|
||||
<constraint firstItem="MC2-dj-tQV" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" constant="7" id="pVJ-z4-AiC"/>
|
||||
<constraint firstItem="o4z-Rh-bJE" firstAttribute="leading" secondItem="yCp-Pc-niT" secondAttribute="trailing" constant="8" id="zG2-tM-7vG"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="descLabe" destination="ncX-Ol-5UJ" id="enJ-bM-x0c"/>
|
||||
<outlet property="levelLabel" destination="MC2-dj-tQV" id="Q7h-xD-OJL"/>
|
||||
<outlet property="nameLab" destination="j4H-3i-r5P" id="ZPg-Ga-jTg"/>
|
||||
<outlet property="noteView" destination="Rvn-dY-yD4" id="R6S-tX-teh"/>
|
||||
<outlet property="timeLabe" destination="o4z-Rh-bJE" id="F9X-HK-lAh"/>
|
||||
<outlet property="userImg" destination="yCp-Pc-niT" id="pd3-Bt-mHx"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-69" y="33.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user