Initial commit
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// UMComFeedDetailCommentCell.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/18.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class UMComComment, UMComLabel, UMComUser, UMComMutiStyleTextView;
|
||||
|
||||
@protocol UMComClickCommentActionDelegate <NSObject>
|
||||
|
||||
- (void)customObj:(id)obj clickOnCommentUser:(UMComUser *)user;
|
||||
- (void)customObj:(id)obj clickOnSpamUser:(UMComUser *)user;
|
||||
- (void)customObj:(id)obj clickOnLikeComment:(UMComComment *)comment;
|
||||
- (void)customObj:(id)obj clickOnDeleteComment:(UMComComment *)comment;
|
||||
- (void)customObj:(id)obj clickOnSpamComment:(UMComComment *)comment;
|
||||
- (void)customObj:(id)obj clickOnCopyComment:(UMComComment *)comment;
|
||||
- (void)customObj:(id)obj clickOnReplyComment:(UMComComment *)comment;
|
||||
- (void)customObj:(id)obj clickOnURL:(NSString *)urlSring;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@interface UMComFeedDetailCommentCell : UITableViewCell
|
||||
|
||||
@property (nonatomic, weak) id<UMComClickCommentActionDelegate> commentActionDelegate;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *customBgView;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *avatorImageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *dateIcon;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
|
||||
@property (weak, nonatomic) IBOutlet UMComMutiStyleTextView *commentContentView;
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *commentContentConstraint;
|
||||
|
||||
|
||||
|
||||
- (IBAction)clickOnReplyButton:(id)sender;
|
||||
|
||||
- (IBAction)clickOnMoreButton:(id)sender;
|
||||
|
||||
- (void)reloadCellWithComment:(UMComComment *)comment;
|
||||
|
||||
|
||||
@end
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
//
|
||||
// UMComFeedDetailCommentCell.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/18.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComFeedDetailCommentCell.h"
|
||||
#import <UMComDataStorage/UMComComment.h>
|
||||
#import "UMComLabel.h"
|
||||
#import <UMComDataStorage/UMComUser.h>
|
||||
#import <UMComDataStorage/UMComImageUrl.h>
|
||||
#import "UMComResouceDefines.h"
|
||||
#import "UMComAvatarImageView.h"
|
||||
#import "UMComMutiStyleTextView.h"
|
||||
#import <UMCommunitySDK/UMComSession.h>
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
@interface UMComFeedDetailCommentCell ()<UIActionSheetDelegate>
|
||||
|
||||
@property (nonatomic, strong) UMComAvatarImageView *realAvatar;
|
||||
|
||||
@property (nonatomic, strong) UMComComment *comment;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComFeedDetailCommentCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
// Initialization code
|
||||
self.realAvatar = [UMComAvatarImageView filletAvatarWithFrame:self.avatorImageView.bounds];
|
||||
[self.avatorImageView addSubview:_realAvatar];
|
||||
self.realAvatar.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapInAvatar:)];
|
||||
[self.realAvatar addGestureRecognizer:tap];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
self.nameLabel.textColor = UMComColorWithHexString(@"#666666");
|
||||
self.dateLabel.textColor = UMComColorWithHexString(@"#999999");
|
||||
}
|
||||
|
||||
- (void)reloadCellWithComment:(UMComComment *)comment
|
||||
{
|
||||
self.comment = comment;
|
||||
self.nameLabel.text = comment.creator.name;
|
||||
self.dateLabel.text = createTimeString(comment.create_time);
|
||||
|
||||
self.commentContentView.lineSpace = 3;
|
||||
NSArray *checkWords = nil;
|
||||
NSString *contentString = comment.content;
|
||||
if (comment.reply_comment || comment.reply_user) {
|
||||
NSString *name = comment.reply_comment.creator.name;
|
||||
if (!name) {
|
||||
name = comment.reply_user.name;
|
||||
}
|
||||
if ([name isKindOfClass:[NSString class]]) {
|
||||
contentString = [NSString stringWithFormat:@"回复@%@:%@",name, contentString];
|
||||
name = [NSString stringWithFormat:@"@%@",name];
|
||||
checkWords = [NSArray arrayWithObject:name];
|
||||
}
|
||||
}
|
||||
UMComMutiText *contentMutiText = [UMComMutiText mutiTextWithSize:CGSizeMake(self.commentContentView.frame.size.width, MAXFLOAT) font:UMComFontNotoSansLightWithSafeSize(14) string:contentString lineSpace:3 checkWords:checkWords textColor:UMComColorWithHexString(@"#999999") highLightColor:UMComColorWithHexString(@"#469ef8")];
|
||||
self.commentContentConstraint.constant = contentMutiText.textSize.height;
|
||||
[self.commentContentView setMutiStyleTextViewWithMutiText:contentMutiText];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.commentContentView.clickOnlinkText = ^(UMComMutiStyleTextView *mutiStyleTextView, UMComMutiTextRun *run){
|
||||
if ([run isKindOfClass:[UMComMutiTextRunClickUser class]]) {
|
||||
if (weakSelf.commentActionDelegate && [weakSelf.commentActionDelegate respondsToSelector:@selector(customObj:clickOnCommentUser:)]) {
|
||||
[weakSelf.commentActionDelegate customObj:weakSelf clickOnCommentUser:comment.reply_comment.creator];
|
||||
}
|
||||
}else if ([run isKindOfClass:[UMComMutiTextRunURL class]]){
|
||||
if (weakSelf.commentActionDelegate && [weakSelf.commentActionDelegate respondsToSelector:@selector(customObj:clickOnURL:)]) {
|
||||
[weakSelf.commentActionDelegate customObj:weakSelf clickOnURL:run.text];
|
||||
}
|
||||
}
|
||||
};
|
||||
[self.realAvatar resetAvatarWithUser:comment.creator];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
[self.commentContentView setNeedsLayout];
|
||||
[self.commentContentView layoutIfNeeded];
|
||||
|
||||
[self.customBgView setNeedsLayout];
|
||||
[self.customBgView layoutIfNeeded];
|
||||
|
||||
[self.contentView setNeedsLayout];
|
||||
[self.contentView layoutIfNeeded];
|
||||
|
||||
// self.contentLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.contentLabel.frame);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - action
|
||||
- (void)tapInAvatar:(UITapGestureRecognizer *)sender
|
||||
{
|
||||
if (self.commentActionDelegate && [self.commentActionDelegate respondsToSelector:@selector(customObj:clickOnCommentUser:)]) {
|
||||
[self.commentActionDelegate customObj:self clickOnCommentUser:self.comment.creator];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)clickOnReplyButton:(UIButton*)sender
|
||||
{
|
||||
[sender setImage:UMComSimpleImageWithImageName(@"um_comment_highlight") forState:UIControlStateHighlighted];
|
||||
|
||||
if (self.commentActionDelegate && [self.commentActionDelegate respondsToSelector:@selector(customObj:clickOnReplyComment:)]) {
|
||||
[self.commentActionDelegate customObj:self clickOnReplyComment:self.comment];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)clickOnMoreButton:(id)sender {
|
||||
|
||||
NSMutableArray *itemTitles = [NSMutableArray array];
|
||||
NSString *title = @"";
|
||||
if ([self checkAuthDeleteComment]) {
|
||||
title = UMComLocalizedString(@"deleted", @"删除");
|
||||
[itemTitles addObject:title];
|
||||
title = UMComLocalizedString(@"copy_comment", @"复制");
|
||||
[itemTitles addObject:title];
|
||||
if (![self.comment.creator.uid isEqualToString:[UMComSession sharedInstance].uid]) {
|
||||
title = UMComLocalizedString(@"spam_user", @"举报用户");
|
||||
[itemTitles addObject:title];
|
||||
|
||||
}
|
||||
}else{
|
||||
title = UMComLocalizedString(@"spam_user", @"举报用户");
|
||||
[itemTitles addObject:title];
|
||||
title = UMComLocalizedString(@"spam_comment", @"举报内容");
|
||||
[itemTitles addObject:title];
|
||||
|
||||
title = UMComLocalizedString(@"copy_comment", @"复制");
|
||||
[itemTitles addObject:title];
|
||||
}
|
||||
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:nil];
|
||||
for (NSString *title in itemTitles) {
|
||||
[actionSheet addButtonWithTitle:title];
|
||||
}
|
||||
|
||||
[actionSheet showInView:self];
|
||||
}
|
||||
|
||||
|
||||
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
|
||||
{
|
||||
NSString *title = [actionSheet buttonTitleAtIndex:buttonIndex];
|
||||
|
||||
if ([title isEqualToString:UMComLocalizedString(@"deleted", @"删除")]) {
|
||||
if (self.commentActionDelegate && [self.commentActionDelegate respondsToSelector:@selector(customObj:clickOnDeleteComment:)]) {
|
||||
[self.commentActionDelegate customObj:self clickOnDeleteComment:self.comment];
|
||||
}
|
||||
}else if ([title isEqualToString:UMComLocalizedString(@"spam_user", @"举报用户")]){
|
||||
if (self.commentActionDelegate && [self.commentActionDelegate respondsToSelector:@selector(customObj:clickOnSpamUser:)]) {
|
||||
[self.commentActionDelegate customObj:self clickOnSpamUser:self.comment.creator];
|
||||
}
|
||||
}else if ([title isEqualToString:UMComLocalizedString(@"spam_comment", @"举报内容")]){
|
||||
if (self.commentActionDelegate && [self.commentActionDelegate respondsToSelector:@selector(customObj:clickOnSpamComment:)]) {
|
||||
[self.commentActionDelegate customObj:self clickOnSpamComment:self.comment];
|
||||
}
|
||||
}else if ([title isEqualToString:UMComLocalizedString(@"copy_comment", @"复制")]){
|
||||
if (self.commentActionDelegate && [self.commentActionDelegate respondsToSelector:@selector(customObj:clickOnCopyComment:)]) {
|
||||
[self.commentActionDelegate customObj:self clickOnCopyComment:self.comment];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)checkAuthDeleteComment
|
||||
{
|
||||
BOOL permission = NO;
|
||||
if ([self.comment.creator.uid isEqualToString:[UMComSession sharedInstance].uid] || (self.comment.permission.integerValue >= 100)) {
|
||||
permission = YES;
|
||||
}
|
||||
return permission;
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
+138
@@ -0,0 +1,138 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="14F1605" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" restorationIdentifier="UMComFeedDetailCommentCell" selectionStyle="default" indentationWidth="10" reuseIdentifier="UMComFeedDetailCommentCell" rowHeight="85" id="KGk-i7-Jjw" customClass="UMComFeedDetailCommentCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="83"/>
|
||||
<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="82"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="ptj-pS-bHS" userLabel="customBgView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="84"/>
|
||||
<subviews>
|
||||
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="kaR-IV-ldu" userLabel="avatorImageView">
|
||||
<rect key="frame" x="10" y="15" width="44" height="44"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="44" id="bXJ-rd-AzH"/>
|
||||
<constraint firstAttribute="height" constant="44" id="z1F-2H-qL6"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="weA-H2-8VI" userLabel="nameLabel">
|
||||
<rect key="frame" x="64" y="15" width="162" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="UMComSimpleSDKResources.bundle/images/um_time" translatesAutoresizingMaskIntoConstraints="NO" id="dZg-j4-hJ9" userLabel="dateIcon">
|
||||
<rect key="frame" x="64" y="39" width="14" height="14"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="14" id="j0w-By-qK1"/>
|
||||
<constraint firstAttribute="height" constant="14" id="rEf-a2-xiG"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="date" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xBk-BT-B41" userLabel="dateLabel">
|
||||
<rect key="frame" x="86" y="39" width="224" height="14"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="q4h-vv-Anm" userLabel="contentView" customClass="UMComMutiStyleTextView">
|
||||
<rect key="frame" x="15" y="69" width="290" height="14"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" priority="750" constant="15" id="beX-8F-Luo"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9mz-PJ-kKH" userLabel="replyButton">
|
||||
<rect key="frame" x="236" y="15" width="32" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="32" id="SEm-US-h5k"/>
|
||||
<constraint firstAttribute="height" constant="32" id="bSG-Ae-9vC"/>
|
||||
</constraints>
|
||||
<state key="normal" image="UMComSimpleSDKResources.bundle/images/um_comment_small_nomal"/>
|
||||
<connections>
|
||||
<action selector="clickOnReplyButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="WSY-xi-X0u"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Wzh-qY-1ab" userLabel="moreButton">
|
||||
<rect key="frame" x="278" y="15" width="32" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="32" id="0ua-JU-qwc"/>
|
||||
<constraint firstAttribute="width" constant="32" id="zLe-sj-5VF"/>
|
||||
</constraints>
|
||||
<state key="normal" image="UMComSimpleSDKResources.bundle/images/um_more"/>
|
||||
<connections>
|
||||
<action selector="clickOnMoreButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="2cn-Bu-MMo"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="V0i-Pm-ynN" userLabel="bottom_line">
|
||||
<rect key="frame" x="0.0" y="83" width="320" height="1"/>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="Iim-tg-zr6"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="Wzh-qY-1ab" secondAttribute="trailing" constant="10" id="0G8-dN-Qig"/>
|
||||
<constraint firstItem="kaR-IV-ldu" firstAttribute="top" secondItem="ptj-pS-bHS" secondAttribute="top" constant="15" id="4IJ-eZ-o3u"/>
|
||||
<constraint firstItem="dZg-j4-hJ9" firstAttribute="leading" secondItem="kaR-IV-ldu" secondAttribute="trailing" constant="10" id="4iI-uQ-a5z"/>
|
||||
<constraint firstItem="xBk-BT-B41" firstAttribute="leading" secondItem="dZg-j4-hJ9" secondAttribute="trailing" constant="8" symbolic="YES" id="BV7-Pg-zzb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="V0i-Pm-ynN" secondAttribute="trailing" id="BZK-rj-zPC"/>
|
||||
<constraint firstItem="dZg-j4-hJ9" firstAttribute="top" secondItem="weA-H2-8VI" secondAttribute="bottom" constant="7" id="DtY-Vo-qIQ"/>
|
||||
<constraint firstItem="weA-H2-8VI" firstAttribute="top" secondItem="kaR-IV-ldu" secondAttribute="top" id="N73-CE-1rq"/>
|
||||
<constraint firstItem="q4h-vv-Anm" firstAttribute="top" secondItem="kaR-IV-ldu" secondAttribute="bottom" constant="10" id="OoU-uO-ONp"/>
|
||||
<constraint firstItem="Wzh-qY-1ab" firstAttribute="leading" secondItem="9mz-PJ-kKH" secondAttribute="trailing" constant="10" id="Pux-Sa-TSU"/>
|
||||
<constraint firstItem="V0i-Pm-ynN" firstAttribute="leading" secondItem="ptj-pS-bHS" secondAttribute="leading" id="Sen-Mp-6J3"/>
|
||||
<constraint firstItem="xBk-BT-B41" firstAttribute="top" secondItem="dZg-j4-hJ9" secondAttribute="top" id="XbM-2q-mVS"/>
|
||||
<constraint firstAttribute="bottom" secondItem="V0i-Pm-ynN" secondAttribute="bottom" id="aVW-nm-xfL"/>
|
||||
<constraint firstAttribute="trailing" secondItem="q4h-vv-Anm" secondAttribute="trailing" constant="15" id="ezj-Sl-N5n"/>
|
||||
<constraint firstItem="q4h-vv-Anm" firstAttribute="leading" secondItem="ptj-pS-bHS" secondAttribute="leading" constant="15" id="f3A-pR-Bl9"/>
|
||||
<constraint firstItem="weA-H2-8VI" firstAttribute="leading" secondItem="kaR-IV-ldu" secondAttribute="trailing" constant="10" id="fE1-ZC-9cG"/>
|
||||
<constraint firstItem="kaR-IV-ldu" firstAttribute="leading" secondItem="ptj-pS-bHS" secondAttribute="leading" constant="10" id="hdG-jE-2dx"/>
|
||||
<constraint firstItem="9mz-PJ-kKH" firstAttribute="leading" secondItem="weA-H2-8VI" secondAttribute="trailing" constant="10" id="jXf-wp-1ql"/>
|
||||
<constraint firstAttribute="trailing" secondItem="xBk-BT-B41" secondAttribute="trailing" constant="10" id="nM6-OW-Kno"/>
|
||||
<constraint firstItem="xBk-BT-B41" firstAttribute="bottom" secondItem="dZg-j4-hJ9" secondAttribute="bottom" id="psW-6e-d8n"/>
|
||||
<constraint firstItem="Wzh-qY-1ab" firstAttribute="top" secondItem="kaR-IV-ldu" secondAttribute="top" id="ruy-eK-xHu"/>
|
||||
<constraint firstAttribute="bottom" secondItem="q4h-vv-Anm" secondAttribute="bottom" constant="1" id="vxQ-cr-2h0"/>
|
||||
<constraint firstItem="9mz-PJ-kKH" firstAttribute="top" secondItem="kaR-IV-ldu" secondAttribute="top" id="ztE-ER-LYb"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="ptj-pS-bHS" secondAttribute="trailing" id="Uvh-FQ-YJ0"/>
|
||||
<constraint firstItem="ptj-pS-bHS" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="ugf-qJ-bbW"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ptj-pS-bHS" secondAttribute="bottom" constant="-2" id="uhk-3e-fZs"/>
|
||||
<constraint firstItem="ptj-pS-bHS" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="zHZ-Lc-9af"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<outlet property="avatorImageView" destination="kaR-IV-ldu" id="abw-yI-hwc"/>
|
||||
<outlet property="commentContentConstraint" destination="beX-8F-Luo" id="Qw1-2f-Aeo"/>
|
||||
<outlet property="commentContentView" destination="q4h-vv-Anm" id="HeN-cv-h9u"/>
|
||||
<outlet property="customBgView" destination="ptj-pS-bHS" id="g6v-bB-Ym0"/>
|
||||
<outlet property="dateIcon" destination="dZg-j4-hJ9" id="Jcs-Jm-c9h"/>
|
||||
<outlet property="dateLabel" destination="xBk-BT-B41" id="F3z-lO-xC9"/>
|
||||
<outlet property="nameLabel" destination="weA-H2-8VI" id="EHd-8J-7E7"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="407" y="-52.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="UMComSimpleSDKResources.bundle/images/um_comment_small_nomal" width="75" height="75"/>
|
||||
<image name="UMComSimpleSDKResources.bundle/images/um_more" width="75" height="75"/>
|
||||
<image name="UMComSimpleSDKResources.bundle/images/um_time" width="75" height="75"/>
|
||||
</resources>
|
||||
</document>
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// UMComFeedDetailTableViewCell.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/18.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "UMComFeedClickActionDelegate.h"
|
||||
|
||||
@class UMComLabel, UMComFeedLargeImageView, UMComFeed,UMComAvatarImageView, UMComMutiStyleTextView;
|
||||
@interface UMComFeedDetailTableViewCell : UITableViewCell
|
||||
|
||||
@property (nonatomic, strong) UMComAvatarImageView *realAvatar;
|
||||
|
||||
@property (nonatomic, weak) id<UMComFeedClickActionDelegate> clickActionDelegate;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *customBgView;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *avatarImageView;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *medalBgView;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton *topicButton;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UMComMutiStyleTextView *feedTextView;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *dateLabel;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *topBgView;
|
||||
|
||||
//约束
|
||||
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *medalTrailingToSuperViewConstraint;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *nameLabelWidthConstraint;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topicButtonWitdhConstraint;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *feedTextLabelHeightConstraint;
|
||||
|
||||
/**
|
||||
* 是否显示话题名字
|
||||
* @discuss 在TopicFeed界面,显示的都是topic下的feed,因此不需要显示话题名字
|
||||
*/
|
||||
@property(nonatomic,assign)BOOL isHideTopicName;
|
||||
|
||||
- (IBAction)clickOnTopicButton:(id)sender;
|
||||
|
||||
|
||||
- (void)reloadCellWithFeed:(UMComFeed *)feed;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
//
|
||||
// UMComFeedDetailTableViewCell.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/18.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComFeedDetailTableViewCell.h"
|
||||
#import <UMComDataStorage/UMComFeed.h>
|
||||
#import "UMComAvatarImageView.h"
|
||||
#import <UMComDataStorage/UMComImageUrl.h>
|
||||
#import "UMComMutiStyleTextView.h"
|
||||
#import <UMComDataStorage/UMComTopic.h>
|
||||
#import <UMComDataStorage/UMComUser.h>
|
||||
#import "UMComResouceDefines.h"
|
||||
#import <UMComDataStorage/UMComMedal.h>
|
||||
#import "UIView+UMComAddition.h"
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
|
||||
@interface UMComFeedDetailTableViewCell ()
|
||||
|
||||
@property (nonatomic, assign) CGFloat lastImageFeedHeight;
|
||||
|
||||
@property (nonatomic, strong) UMComFeed *feed;
|
||||
|
||||
@property (nonatomic, strong) UMComTopic *topic;
|
||||
|
||||
@property (nonatomic, strong) UMComImageView *medalImageView;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComFeedDetailTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
|
||||
self.realAvatar = [UMComAvatarImageView filletAvatarWithFrame:self.avatarImageView.bounds];
|
||||
[self.avatarImageView addSubview:_realAvatar];
|
||||
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapInAvatar:)];
|
||||
[self.realAvatar addGestureRecognizer:tap];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
self.nameLabel.textColor = UMComColorWithHexString(@"#999999");
|
||||
self.dateLabel.textColor = UMComColorWithHexString(@"#999999");
|
||||
self.feedTextView.textColor = UMComColorWithHexString(@"#333333");
|
||||
[self.topicButton setTitleColor:UMComColorWithHexString(@"#469EF8") forState:UIControlStateNormal];
|
||||
self.topicButton.layer.borderWidth = 1;
|
||||
self.topicButton.layer.cornerRadius = 3;
|
||||
self.topicButton.clipsToBounds = YES;
|
||||
self.topicButton.layer.borderColor = UMComColorWithHexString(@"#469EF8").CGColor;
|
||||
self.medalImageView = [[[UMComImageView imageViewClassName] alloc] init];
|
||||
self.medalImageView.frame = self.medalBgView.bounds;
|
||||
[self.medalBgView addSubview:self.medalImageView];
|
||||
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
}
|
||||
|
||||
|
||||
- (void)reloadCellWithFeed:(UMComFeed *)feed
|
||||
{
|
||||
self.feed = feed;
|
||||
[self.realAvatar resetAvatarWithUser:feed.creator];
|
||||
|
||||
if (feed.topics.count > 0) {
|
||||
UMComTopic *topic = feed.topics.firstObject;
|
||||
NSString *topicName = topic.name;
|
||||
[self.topicButton setTitle:topicName forState:UIControlStateNormal];
|
||||
self.topic = topic;
|
||||
self.topicButton.hidden = NO;
|
||||
|
||||
}else{
|
||||
self.topicButtonWitdhConstraint.constant = 0;
|
||||
self.topicButton.hidden = YES;
|
||||
}
|
||||
|
||||
if (feed.creator.medal_list.count > 0) {
|
||||
UMComMedal *medal = feed.creator.medal_list.firstObject;
|
||||
[self.medalImageView setImageURL:medal.icon_url placeHolderImage:nil];
|
||||
self.nameLabelWidthConstraint.constant = -20;
|
||||
self.medalBgView.hidden = NO;
|
||||
}else{
|
||||
self.nameLabelWidthConstraint.constant = 0;
|
||||
self.medalBgView.hidden = YES;
|
||||
}
|
||||
self.nameLabel.text = feed.creator.name;
|
||||
if (feed.text.length > 0) {
|
||||
self.feedTextView.lineSpace = 4;
|
||||
UMComMutiText *mutiText = [UMComMutiText mutiTextWithSize:CGSizeMake(self.feedTextView.width_, MAXFLOAT) font:self.feedTextView.font string:feed.text lineSpace:self.feedTextView.lineSpace checkWords:nil textColor:UMComColorWithHexString(@"#333333") highLightColor:UMComColorWithHexString(@"#469EF8")];
|
||||
self.feedTextView.pointOffset = CGPointMake(0, self.feedTextView.lineSpace/2);
|
||||
self.feedTextView.height_ = mutiText.textSize.height+self.feedTextView.lineSpace;
|
||||
self.feedTextView.height_ = mutiText.textSize.height;
|
||||
[self.feedTextView setMutiStyleTextViewWithMutiText:mutiText];
|
||||
self.feedTextLabelHeightConstraint.constant = _feedTextView.height_;
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.feedTextView.clickOnlinkText = ^(UMComMutiStyleTextView *feedTextView,UMComMutiTextRun *run){
|
||||
if ([run isKindOfClass:[UMComMutiTextRunURL class]]) {
|
||||
[weakSelf clickOnUrl:run.text];
|
||||
}
|
||||
};
|
||||
}else{
|
||||
[self.feedTextView removeFromSuperview];
|
||||
}
|
||||
self.dateLabel.text = createTimeString(feed.create_time);
|
||||
|
||||
if (self.isHideTopicName) {
|
||||
[self.topicButton removeFromSuperview];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
[self.customBgView setNeedsLayout];
|
||||
[self.customBgView layoutIfNeeded];
|
||||
|
||||
[self.contentView setNeedsLayout];
|
||||
[self.contentView layoutIfNeeded];
|
||||
|
||||
self.nameLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.nameLabel.frame);
|
||||
}
|
||||
|
||||
#pragma mark - action
|
||||
|
||||
- (void)clickOnUrl:(NSString *)urlString
|
||||
{
|
||||
if (self.clickActionDelegate && [self.clickActionDelegate respondsToSelector:@selector(customObj:clickOnURL:)]) {
|
||||
[self.clickActionDelegate customObj:self clickOnURL:urlString];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)tapInAvatar:(UITapGestureRecognizer *)sender
|
||||
{
|
||||
if (self.clickActionDelegate && [self.clickActionDelegate respondsToSelector:@selector(customObj:clickOnFeedCreator:)]) {
|
||||
[self.clickActionDelegate customObj:self clickOnFeedCreator:self.feed.creator];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)clickOnTopicButton:(id)sender {
|
||||
|
||||
if (self.clickActionDelegate && [self.clickActionDelegate respondsToSelector:@selector(customObj:clickOnTopic:)]) {
|
||||
[self.clickActionDelegate customObj:self clickOnTopic:self.topic];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
+162
@@ -0,0 +1,162 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="14F1605" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UMComSimpleFeedDetailViewController"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="UMComFeedDetailTableViewCell" id="KGk-i7-Jjw" userLabel="UMComFeedDetailTableViewCell" customClass="UMComFeedDetailTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="90"/>
|
||||
<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="89"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wsB-Vs-3xj" userLabel="customBgView">
|
||||
<rect key="frame" x="0.0" y="15" width="320" height="74"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="AXA-Oa-R21" userLabel="topBgView">
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="24"/>
|
||||
<subviews>
|
||||
<imageView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="0lc-n4-Hp0">
|
||||
<rect key="frame" x="0.0" y="0.0" width="24" height="24"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="24" id="4nm-Tl-fWU"/>
|
||||
<constraint firstAttribute="height" constant="24" id="k2B-HR-MzJ"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="nFH-AY-Xah" userLabel="nameAndMedal">
|
||||
<rect key="frame" x="34" y="0.0" width="159" height="24"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jyR-75-VTU" userLabel="medalView">
|
||||
<rect key="frame" x="33" y="2" width="20" height="20"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" priority="750" constant="20" id="KKH-DL-YVw"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="750" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dNB-Ze-aGo" userLabel="nameLabel">
|
||||
<rect key="frame" x="0.0" y="6" width="31" height="12"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="dNB-Ze-aGo" secondAttribute="bottom" constant="6" id="1G1-Tv-DxO"/>
|
||||
<constraint firstItem="dNB-Ze-aGo" firstAttribute="top" secondItem="nFH-AY-Xah" secondAttribute="top" constant="6" id="1uE-7v-yji"/>
|
||||
<constraint firstItem="dNB-Ze-aGo" firstAttribute="width" relation="lessThanOrEqual" secondItem="nFH-AY-Xah" secondAttribute="width" multiplier="1:1" constant="-20" id="8Vf-41-y3t"/>
|
||||
<constraint firstItem="jyR-75-VTU" firstAttribute="top" secondItem="nFH-AY-Xah" secondAttribute="top" constant="2" id="Am3-Uf-cPc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="dNB-Ze-aGo" secondAttribute="trailing" priority="250" id="Lgv-Vg-yJe"/>
|
||||
<constraint firstItem="jyR-75-VTU" firstAttribute="leading" secondItem="dNB-Ze-aGo" secondAttribute="trailing" constant="2" id="LnC-ye-jF6"/>
|
||||
<constraint firstAttribute="bottom" secondItem="jyR-75-VTU" secondAttribute="bottom" constant="2" id="VR9-m2-xhB"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jyR-75-VTU" secondAttribute="trailing" priority="250" id="qcw-dk-TKY"/>
|
||||
<constraint firstItem="dNB-Ze-aGo" firstAttribute="leading" secondItem="nFH-AY-Xah" secondAttribute="leading" id="vmt-Yk-ZW7"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<button opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" horizontalCompressionResistancePriority="751" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="tailTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mOS-TC-Mcf" userLabel="topicButton">
|
||||
<rect key="frame" x="203" y="2" width="87" height="20"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="lessThanOrEqual" priority="900" constant="87" id="cVd-e0-sPF"/>
|
||||
<constraint firstAttribute="width" relation="greaterThanOrEqual" constant="35" id="yjK-y7-FIc"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<inset key="contentEdgeInsets" minX="5" minY="3" maxX="5" maxY="3"/>
|
||||
<state key="normal" title="此处应有个话题">
|
||||
<color key="titleColor" red="0.2901960784" green="0.59607843140000005" blue="0.96470588239999999" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</state>
|
||||
<connections>
|
||||
<action selector="clickOnTopicButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="b3i-se-pgW"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="nFH-AY-Xah" firstAttribute="leading" secondItem="0lc-n4-Hp0" secondAttribute="trailing" constant="10" id="Atp-z2-jM7"/>
|
||||
<constraint firstItem="0lc-n4-Hp0" firstAttribute="top" secondItem="AXA-Oa-R21" secondAttribute="top" id="FvQ-G7-tHr"/>
|
||||
<constraint firstItem="nFH-AY-Xah" firstAttribute="top" secondItem="AXA-Oa-R21" secondAttribute="top" id="OS1-2F-C4H"/>
|
||||
<constraint firstItem="mOS-TC-Mcf" firstAttribute="leading" secondItem="nFH-AY-Xah" secondAttribute="trailing" constant="10" id="evq-68-OZZ"/>
|
||||
<constraint firstAttribute="bottom" secondItem="nFH-AY-Xah" secondAttribute="bottom" id="hsv-4o-0p5"/>
|
||||
<constraint firstItem="mOS-TC-Mcf" firstAttribute="top" secondItem="AXA-Oa-R21" secondAttribute="top" constant="2" id="oId-9d-kCz"/>
|
||||
<constraint firstAttribute="trailing" secondItem="mOS-TC-Mcf" secondAttribute="trailing" id="r9N-NH-tqp"/>
|
||||
<constraint firstAttribute="bottom" secondItem="mOS-TC-Mcf" secondAttribute="bottom" constant="2" id="tcO-GM-P0f"/>
|
||||
<constraint firstAttribute="height" constant="24" id="veJ-Lc-3ZF"/>
|
||||
<constraint firstItem="0lc-n4-Hp0" firstAttribute="leading" secondItem="AXA-Oa-R21" secondAttribute="leading" id="z2u-KW-bgk"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Bel-DP-Oth" userLabel="feedTextView" customClass="UMComMutiStyleTextView">
|
||||
<rect key="frame" x="15" y="34" width="290" height="10"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" priority="750" constant="10" id="7xb-QW-BJO"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" image="UMComSimpleSDKResources.bundle/images/um_time" translatesAutoresizingMaskIntoConstraints="NO" id="ZPZ-00-fEA" userLabel="dateIcon">
|
||||
<rect key="frame" x="15" y="54" width="12" height="12"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="12" id="1ll-lW-tEF"/>
|
||||
<constraint firstAttribute="width" constant="12" id="mph-JZ-2nv"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="zAq-Pm-Tma" userLabel="DateLabel">
|
||||
<rect key="frame" x="37" y="54" width="268" height="10"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="10" id="iSO-vD-Xkb"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="10"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="ZPZ-00-fEA" firstAttribute="leading" secondItem="wsB-Vs-3xj" secondAttribute="leading" constant="15" id="2Nm-zn-7Sw"/>
|
||||
<constraint firstItem="zAq-Pm-Tma" firstAttribute="top" secondItem="AXA-Oa-R21" secondAttribute="bottom" priority="250" constant="10" id="H9Q-3F-JXk"/>
|
||||
<constraint firstItem="Bel-DP-Oth" firstAttribute="top" secondItem="AXA-Oa-R21" secondAttribute="bottom" constant="10" id="HvM-Br-Zhs"/>
|
||||
<constraint firstItem="zAq-Pm-Tma" firstAttribute="leading" secondItem="ZPZ-00-fEA" secondAttribute="trailing" constant="10" id="Kqc-fd-xUZ"/>
|
||||
<constraint firstItem="AXA-Oa-R21" firstAttribute="leading" secondItem="wsB-Vs-3xj" secondAttribute="leading" constant="15" id="O0W-iP-5kk"/>
|
||||
<constraint firstItem="zAq-Pm-Tma" firstAttribute="top" secondItem="Bel-DP-Oth" secondAttribute="bottom" constant="10" id="eFE-zy-2Zn"/>
|
||||
<constraint firstItem="zAq-Pm-Tma" firstAttribute="top" secondItem="ZPZ-00-fEA" secondAttribute="top" id="gsO-iQ-T5h"/>
|
||||
<constraint firstAttribute="trailing" secondItem="AXA-Oa-R21" secondAttribute="trailing" constant="15" id="hD1-SI-VuI"/>
|
||||
<constraint firstItem="Bel-DP-Oth" firstAttribute="leading" secondItem="wsB-Vs-3xj" secondAttribute="leading" constant="15" id="hf7-Pe-foo"/>
|
||||
<constraint firstAttribute="bottom" secondItem="zAq-Pm-Tma" secondAttribute="bottom" constant="10" id="iH0-sx-bxI"/>
|
||||
<constraint firstAttribute="trailing" secondItem="Bel-DP-Oth" secondAttribute="trailing" constant="15" id="oIB-5A-QCU"/>
|
||||
<constraint firstItem="AXA-Oa-R21" firstAttribute="top" secondItem="wsB-Vs-3xj" secondAttribute="top" id="qps-4R-LOL"/>
|
||||
<constraint firstAttribute="trailing" secondItem="zAq-Pm-Tma" secondAttribute="trailing" constant="15" id="xqh-nx-0dH"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="wsB-Vs-3xj" secondAttribute="bottom" id="Cns-WZ-fjN"/>
|
||||
<constraint firstAttribute="trailing" secondItem="wsB-Vs-3xj" secondAttribute="trailing" id="Iil-76-ILH"/>
|
||||
<constraint firstItem="wsB-Vs-3xj" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="Pj7-ou-ISO"/>
|
||||
<constraint firstItem="wsB-Vs-3xj" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="oxm-4q-tnW"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<outlet property="avatarImageView" destination="0lc-n4-Hp0" id="h5J-nu-P57"/>
|
||||
<outlet property="customBgView" destination="wsB-Vs-3xj" id="KE1-HI-Ihv"/>
|
||||
<outlet property="dateLabel" destination="zAq-Pm-Tma" id="IZ3-9q-pEh"/>
|
||||
<outlet property="feedTextLabelHeightConstraint" destination="7xb-QW-BJO" id="zjK-MW-dAW"/>
|
||||
<outlet property="feedTextView" destination="Bel-DP-Oth" id="Gwj-ft-Yry"/>
|
||||
<outlet property="medalBgView" destination="jyR-75-VTU" id="Gcd-ro-VDi"/>
|
||||
<outlet property="medalTrailingToSuperViewConstraint" destination="qcw-dk-TKY" id="AJg-4Q-Dxo"/>
|
||||
<outlet property="nameLabel" destination="dNB-Ze-aGo" id="Cca-WT-2i8"/>
|
||||
<outlet property="nameLabelWidthConstraint" destination="8Vf-41-y3t" id="Tb7-gB-c0J"/>
|
||||
<outlet property="topBgView" destination="AXA-Oa-R21" id="Tb2-Ek-chH"/>
|
||||
<outlet property="topicButton" destination="mOS-TC-Mcf" id="LCP-6E-Nt5"/>
|
||||
<outlet property="topicButtonWitdhConstraint" destination="cVd-e0-sPF" id="qWw-PE-AoY"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="183" y="-294"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="UMComSimpleSDKResources.bundle/images/um_time" width="75" height="75"/>
|
||||
</resources>
|
||||
</document>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// UMComLargeImageTableViewCell.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/6/1.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@class UMComImageView;
|
||||
@interface UMComLargeImageTableViewCell : UITableViewCell
|
||||
|
||||
@property (nonatomic, strong) UMComImageView *umImageView;
|
||||
|
||||
@property (nonatomic, strong) NSArray *imageUrlArray;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *imageBgView;
|
||||
|
||||
@end
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
//
|
||||
// UMComLargeImageTableViewCell.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/6/1.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComLargeImageTableViewCell.h"
|
||||
#import "UMComImageView.h"
|
||||
#import <UMComDataStorage/UMComImageUrl.h>
|
||||
#import "UMComSimpleGridViewerController.h"
|
||||
|
||||
@interface UMComLargeImageTableViewCell()
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation UMComLargeImageTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
// Initialization code
|
||||
|
||||
self.umImageView = [[[UMComImageView imageViewClassName] alloc] init];
|
||||
self.umImageView.frame = self.imageBgView.bounds;
|
||||
[self.imageBgView addSubview:self.umImageView];
|
||||
|
||||
self.umImageView.backgroundColor = [UIColor whiteColor];
|
||||
self.imageBgView.backgroundColor = [UIColor whiteColor];
|
||||
self.contentView.backgroundColor = [UIColor whiteColor];
|
||||
|
||||
self.umImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(showImageBrowserViewWithSender:)];
|
||||
[self.umImageView addGestureRecognizer:tap];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
self.umImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
[self.imageBgView setNeedsLayout];
|
||||
[self.imageBgView layoutIfNeeded];
|
||||
|
||||
[self.contentView setNeedsLayout];
|
||||
[self.contentView layoutIfNeeded];
|
||||
}
|
||||
|
||||
|
||||
- (void)showImageBrowserViewWithSender:(UITapGestureRecognizer *)tap
|
||||
{
|
||||
UMComImageView *imageView = (UMComImageView *)tap.view;
|
||||
NSInteger index = 0;
|
||||
for (UMComImageUrl *imageUrl in self.imageUrlArray) {
|
||||
if ([imageUrl.midle_url_string isEqualToString:[imageView.imageURL absoluteString]]) {
|
||||
index = [self.imageUrlArray indexOfObject:imageUrl];
|
||||
}
|
||||
}
|
||||
UMComSimpleGridViewerController *viewerController = [[UMComSimpleGridViewerController alloc] initWithArray:self.imageUrlArray index:index];
|
||||
viewerController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
||||
[[UIApplication sharedApplication].keyWindow.rootViewController presentViewController:viewerController animated:YES completion:nil];
|
||||
}
|
||||
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
@end
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="14F27" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" restorationIdentifier="UMComLargeImageTableViewCell" selectionStyle="default" indentationWidth="10" reuseIdentifier="UMComLargeImageTableViewCell" id="KGk-i7-Jjw" customClass="UMComLargeImageTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="300"/>
|
||||
<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="299.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ABH-tA-VeH" userLabel="imageBgView">
|
||||
<rect key="frame" x="15" y="0.0" width="290" height="289"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="ABH-tA-VeH" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="Bip-wM-Ina"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ABH-tA-VeH" secondAttribute="trailing" constant="15" id="MJa-Jt-6Wc"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ABH-tA-VeH" secondAttribute="bottom" constant="10" id="ZH1-ag-RAM"/>
|
||||
<constraint firstItem="ABH-tA-VeH" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="wHw-Fl-0Wh"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="imageBgView" destination="ABH-tA-VeH" id="XEA-nd-LaQ"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="-335" y="202"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// UMComLikeButtonTableViewCell.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/6/2.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface UMComLikeButtonTableViewCell : UITableViewCell
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIButton *likeButton;
|
||||
|
||||
@property (nonatomic, copy) void (^clickOnLikeButton)(UIButton *button);
|
||||
|
||||
- (IBAction)onClikOnLikeButton:(UIButton *)sender;
|
||||
|
||||
@end
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// UMComLikeButtonTableViewCell.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/6/2.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComLikeButtonTableViewCell.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
@implementation UMComLikeButtonTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
self.likeButton.clipsToBounds = YES;
|
||||
self.likeButton.layer.cornerRadius = self.likeButton.frame.size.height/2;
|
||||
self.likeButton.layer.borderWidth = 1;
|
||||
self.likeButton.layer.borderColor = UMComColorWithHexString(@"#469EF8").CGColor;
|
||||
// Initialization code
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
- (IBAction)onClikOnLikeButton:(UIButton *)sender {
|
||||
|
||||
if (self.clickOnLikeButton) {
|
||||
self.clickOnLikeButton(sender);
|
||||
}
|
||||
}
|
||||
@end
|
||||
+58
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="14F1605" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
|
||||
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="UMComLikeButtonTableViewCell" id="KGk-i7-Jjw" customClass="UMComLikeButtonTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="40"/>
|
||||
<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="39"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" adjustsImageWhenHighlighted="NO" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="wg1-db-NpW">
|
||||
<rect key="frame" x="115" y="0.0" width="90" height="32"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="90" id="n3f-dA-s7J"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<inset key="titleEdgeInsets" minX="6" minY="6" maxX="0.0" maxY="5"/>
|
||||
<inset key="imageEdgeInsets" minX="19" minY="4" maxX="49" maxY="6"/>
|
||||
<state key="normal" title="Button" image="UMComSimpleSDKResources.bundle/images/um_like_blue"/>
|
||||
<connections>
|
||||
<action selector="onClikOnLikeButton:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="Khl-kP-Vrb"/>
|
||||
</connections>
|
||||
</button>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NH5-i4-j7S">
|
||||
<rect key="frame" x="8" y="38" width="312" height="1"/>
|
||||
<color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="1" id="GtK-41-qga"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="NH5-i4-j7S" secondAttribute="bottom" id="1Mv-Mh-hFe"/>
|
||||
<constraint firstItem="wg1-db-NpW" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="AEf-ey-5hW"/>
|
||||
<constraint firstAttribute="trailing" secondItem="NH5-i4-j7S" secondAttribute="trailing" id="KpK-x6-gnh"/>
|
||||
<constraint firstItem="wg1-db-NpW" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="an6-mw-b7S"/>
|
||||
<constraint firstAttribute="bottom" secondItem="wg1-db-NpW" secondAttribute="bottom" constant="7" identifier="LikeButtonBottomToSuperView" id="gVN-jf-k80"/>
|
||||
<constraint firstItem="NH5-i4-j7S" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leadingMargin" id="yJB-iu-z0k"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="likeButton" destination="wg1-db-NpW" id="Uaq-uR-b9S"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="203" y="171"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="UMComSimpleSDKResources.bundle/images/um_like_blue" width="75" height="75"/>
|
||||
</resources>
|
||||
</document>
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// UMComSimpleFeedDetailViewController.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/17.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSimpleFeedTableViewController.h"
|
||||
#import "UMComSimpleFeedOperationFinishDelegate.h"
|
||||
|
||||
@class UMComFeed;
|
||||
@interface UMComSimpleFeedDetailViewController : UMComSimpleFeedTableViewController
|
||||
|
||||
|
||||
@property (nonatomic, strong) UMComFeed *feed;
|
||||
|
||||
@property (nonatomic, assign)BOOL autoShowCommentEditView;
|
||||
|
||||
@property (nonatomic,weak)id<UMComSimpleFeedOperationFinishDelegate> feedOperationDelegate;
|
||||
|
||||
@end
|
||||
+1005
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user