Initial commit
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// UMComSimpleAssociatedFeedTableViewCell.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/24/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "UMComFeedClickActionDelegate.h"
|
||||
|
||||
static NSString *kUMComSimpleAssociatedFeedTableViewCellId = @"UMComSimpleAssociatedFeedTableViewCellId";
|
||||
static NSString *kUMComSimpleAssociatedFeedTableViewCellName = @"UMComSimpleAssociatedFeedTableViewCell";
|
||||
|
||||
@class UMComMutiStyleTextView;
|
||||
@class UMComImageView;
|
||||
@class UMComComment;
|
||||
@class UMComImageView;
|
||||
|
||||
@interface UMComSimpleAssociatedFeedTableViewCell : UITableViewCell
|
||||
@property (weak, nonatomic) IBOutlet UIView *cardView;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UILabel *creatorNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UMComImageView *creatorAvatar;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIImageView *timeIcon;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *timeLabel;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UMComMutiStyleTextView *commentLabel;
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *picFeedView;
|
||||
@property (weak, nonatomic) IBOutlet UMComImageView *feedImageView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *feedCreatorNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *feedTextLabel;
|
||||
|
||||
|
||||
@property (weak, nonatomic) IBOutlet UIView *textFeedView;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *textFeedCreatorNameLabel;
|
||||
@property (weak, nonatomic) IBOutlet UILabel *textFeedTextLabel;
|
||||
|
||||
@property (nonatomic, weak) id<UMComFeedClickActionDelegate> delegate;
|
||||
|
||||
- (void)refreshWithBeLiked:(UMComLike *)like;
|
||||
- (void)refreshWithComment:(UMComComment *)comment;
|
||||
|
||||
@end
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
//
|
||||
// UMComSimpleAssociatedFeedTableViewCell.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/24/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSimpleAssociatedFeedTableViewCell.h"
|
||||
#import <UMComDataStorage/UMComComment.h>
|
||||
#import <UMComDataStorage/UMComUser.h>
|
||||
#import <UMComDataStorage/UMComFeed.h>
|
||||
#import "UMComImageView.h"
|
||||
#import <UMComDataStorage/UMComImageUrl.h>
|
||||
#import "UMComResouceDefines.h"
|
||||
#import "UMComMutiStyleTextView.h"
|
||||
#import <UMComFoundation/UMComKit+Autolayout.h>
|
||||
#import <UMComFoundation/UMComConstraintCache.h>
|
||||
#import "UMComSimpleGridViewerController.h"
|
||||
#import <UMComDataStorage/UMComLike.h>
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
@interface UMComSimpleAssociatedFeedTableViewCell ()
|
||||
|
||||
@property (nonatomic, strong) UMComConstraintCacheManager *cacheManager;
|
||||
|
||||
@property (nonatomic, strong) UMComUser *creator;
|
||||
@property (nonatomic, strong) UMComUser *replyUser;
|
||||
|
||||
@property (nonatomic, strong) UMComFeed *feed;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComSimpleAssociatedFeedTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
self.cardView.layer.borderColor = UMComColorWithHexString(@"#dfdfdf").CGColor;
|
||||
self.cardView.layer.borderWidth = 1.f;
|
||||
|
||||
self.cacheManager = [[UMComConstraintCacheManager alloc] init];
|
||||
|
||||
//设置所有label的textAlignment
|
||||
//http://stackoverflow.com/questions/16144671/nstextalignmentjustified-throws-error
|
||||
self.creatorNameLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.timeLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.feedCreatorNameLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.feedTextLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.textFeedCreatorNameLabel.textAlignment = NSTextAlignmentLeft;
|
||||
self.textFeedTextLabel.textAlignment = NSTextAlignmentLeft;
|
||||
|
||||
[self initEventForViews];
|
||||
}
|
||||
|
||||
- (void)initEventForViews
|
||||
{
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(enterFeedDetailView:)];
|
||||
[_picFeedView addGestureRecognizer:tap];
|
||||
|
||||
tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(enterFeedDetailView:)];
|
||||
[_textFeedView addGestureRecognizer:tap];
|
||||
|
||||
tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(enterCreatorUserCenter:)];
|
||||
[_creatorAvatar addGestureRecognizer:tap];
|
||||
|
||||
tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(enterFeedCreatorUserCenter:)];
|
||||
[_feedCreatorNameLabel addGestureRecognizer:tap];
|
||||
|
||||
tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(enterFeedCreatorUserCenter:)];
|
||||
[_textFeedCreatorNameLabel addGestureRecognizer:tap];
|
||||
|
||||
tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(openFeedImage:)];
|
||||
[_feedImageView addGestureRecognizer:tap];
|
||||
}
|
||||
|
||||
- (void)enterFeedDetailView:(id)sender
|
||||
{
|
||||
if (_feed.status.integerValue >= 2) {
|
||||
return;
|
||||
}
|
||||
if (_delegate && [self.delegate respondsToSelector:@selector(customObj:clickOnFeedText:)]) {
|
||||
[_delegate customObj:self clickOnFeedText:_feed];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enterCreatorUserCenter:(id)sender
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(customObj:clickOnFeedCreator:)]) {
|
||||
[_delegate customObj:self clickOnFeedCreator:_creator];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enterFeedCreatorUserCenter:(id)sender
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(customObj:clickOnFeedCreator:)]) {
|
||||
[_delegate customObj:self clickOnFeedCreator:_feed.creator];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enterReplyUserCenter:(UMComUser *)user
|
||||
{
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
if ([_delegate respondsToSelector:@selector(customObj:clickOnFeedCreator:)]) {
|
||||
[_delegate customObj:self clickOnFeedCreator:user];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)enterUrlWithString:(NSString *)url
|
||||
{
|
||||
if (!url) {
|
||||
return;
|
||||
}
|
||||
if ([_delegate respondsToSelector:@selector(customObj:clickOnURL:)]) {
|
||||
[_delegate customObj:self clickOnURL:url];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)openFeedImage:(id)sender
|
||||
{
|
||||
if (_feed.image_urls.count == 0) {
|
||||
return;
|
||||
}
|
||||
UMComImageUrl *imageUrl = _feed.image_urls[0];
|
||||
UMComSimpleGridViewerController *controller = [[UMComSimpleGridViewerController alloc] initWithArray:@[imageUrl] index:0];
|
||||
if ([_delegate respondsToSelector:@selector(customObj:clickOnImageView:complitionBlock:)]) {
|
||||
[_delegate customObj:self clickOnImageView:nil complitionBlock:^(UIViewController *currentViewController) {
|
||||
[currentViewController presentViewController:controller animated:YES completion:nil];
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
}
|
||||
|
||||
- (void)refreshWithBeLiked:(UMComLike *)like
|
||||
{
|
||||
[self refreshCellWithFeed:like.feed creator:like.creator time:like.create_time content:UMComLocalizedString(@"um_com_liked_feed", @"赞了这条动态") checkWords:nil];
|
||||
}
|
||||
|
||||
- (void)refreshWithComment:(UMComComment *)comment
|
||||
{
|
||||
UMComFeed *originFeed = comment.feed;
|
||||
|
||||
_replyUser = comment.reply_user;
|
||||
|
||||
NSString *commentContent = comment.content;
|
||||
NSString *name = nil;
|
||||
if (_replyUser) {
|
||||
name = [NSString stringWithFormat:@"@%@", _replyUser.name];
|
||||
commentContent = [NSString stringWithFormat:@"%@%@: %@", UMComLocalizedString(@"reply", @"回复"), name, commentContent];
|
||||
}
|
||||
|
||||
[self refreshCellWithFeed:originFeed creator:comment.creator time:comment.create_time content:commentContent checkWords:name ? @[name] : nil];
|
||||
}
|
||||
|
||||
- (void)refreshCellWithFeed:(UMComFeed *)feed creator:(UMComUser *)creator time:(NSString *)time content:(NSString *)content checkWords:(NSArray *)checkWords
|
||||
{
|
||||
self.feed = feed;
|
||||
self.creator = creator;
|
||||
|
||||
[_creatorAvatar setImageURL:creator.icon_url.midle_url_string placeHolderImage:[UMComImageView placeHolderImageGender:creator.gender.integerValue]];
|
||||
_creatorNameLabel.text = creator.name;
|
||||
UMComMutiText *text = [UMComMutiText mutiTextWithSize:CGSizeMake(_commentLabel.frame.size.width, INT_MAX)
|
||||
font:[UIFont systemFontOfSize:12.f]
|
||||
string:content
|
||||
lineSpace:2.f
|
||||
checkWords:checkWords
|
||||
textColor:UMComColorWithHexString(@"#666666")
|
||||
highLightColor:UMComColorWithHexString(@"#469ef8")];
|
||||
[_commentLabel setMutiStyleTextViewWithMutiText:text];
|
||||
__weak typeof(self) ws = self;
|
||||
_commentLabel.clickOnlinkText = ^(UMComMutiStyleTextView *mutiStyleTextView,UMComMutiTextRun *run) {
|
||||
if (run) {
|
||||
if ([run.text hasPrefix:@"@"]) {
|
||||
[ws enterReplyUserCenter:ws.replyUser];
|
||||
} else if ([run.text hasPrefix:@"http"]) {
|
||||
[ws enterUrlWithString:run.text];
|
||||
}
|
||||
}
|
||||
};
|
||||
[UMComKit ALView:_commentLabel setConstraintConstant:text.textSize.height forAttribute:NSLayoutAttributeHeight];
|
||||
|
||||
[_timeIcon setImage:UMComSimpleImageWithImageName(@"um_time")];
|
||||
_timeLabel.text = createTimeString(time);
|
||||
|
||||
NSString *textFeedViewKey = @"textFeedView";
|
||||
NSString *picFeedViewKey = @"picFeedView";
|
||||
|
||||
|
||||
if (feed.image_urls.count == 0 || feed.status.integerValue >= 2) {
|
||||
[_cacheManager cacheViewConstraints:_picFeedView forKey:picFeedViewKey];
|
||||
[_picFeedView removeFromSuperview];
|
||||
[_cacheManager restoreViewConstraintsToSuperView:_textFeedView forKey:textFeedViewKey];
|
||||
|
||||
NSString *feedCreatrName = nil;
|
||||
NSString *feedText = nil;
|
||||
if (feed.status.integerValue < 2) {
|
||||
feedCreatrName = [NSString stringWithFormat:@"@%@", feed.creator.name];
|
||||
feedText = [NSString stringWithFormat:@": %@", feed.text];
|
||||
} else {
|
||||
feedCreatrName = @"";
|
||||
feedText = UMComLocalizedString(@"um_com_feed_deleted", @"该内容已被删除");
|
||||
}
|
||||
_textFeedCreatorNameLabel.text = feedCreatrName;
|
||||
_textFeedTextLabel.text = feedText;
|
||||
} else {
|
||||
[_cacheManager cacheViewConstraints:_textFeedView forKey:textFeedViewKey];
|
||||
[_textFeedView removeFromSuperview];
|
||||
[_cacheManager restoreViewConstraintsToSuperView:_picFeedView forKey:picFeedViewKey];
|
||||
|
||||
UMComImageUrl *urlObj = feed.image_urls[0];
|
||||
[_feedImageView setImageURL:urlObj.midle_url_string placeHolderImage:nil];
|
||||
|
||||
_feedCreatorNameLabel.text = [NSString stringWithFormat:@"@%@", feed.creator.name];
|
||||
_feedTextLabel.text = feed.text;
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - action
|
||||
|
||||
- (void)didOnUserAvatar:(id)sender
|
||||
{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(customObj:clickOnFeedCreator:)]) {
|
||||
[self.delegate customObj:self clickOnFeedCreator:self.feed.creator];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)goToFeedDetaiView
|
||||
{
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(customObj:clickOnFeedText:)]) {
|
||||
[self.delegate customObj:self clickOnFeedText:self.feed];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)clickOnLikeButton:(id)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(customObj:clickOnLikeFeed:)]) {
|
||||
[self.delegate customObj:self clickOnLikeFeed:self.feed];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)clickOnCommentButton:(id)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(customObj:clickOnCommentFeed:)]) {
|
||||
[self.delegate customObj:self clickOnCommentFeed:self.feed];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)clickOnTopicButton:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(customObj:clickOnTopic:)]) {
|
||||
if (self.feed.topics.count > 0) {
|
||||
UMComTopic *topic = self.feed.topics.firstObject;
|
||||
[self.delegate customObj:self clickOnTopic:topic];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+204
@@ -0,0 +1,204 @@
|
||||
<?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" useTraitCollections="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" selectionStyle="default" indentationWidth="10" rowHeight="216" id="KGk-i7-Jjw" customClass="UMComSimpleAssociatedFeedTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="524" height="216"/>
|
||||
<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="524" height="215.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qg8-79-2dp" userLabel="card_view">
|
||||
<rect key="frame" x="0.0" y="10" width="524" height="205.5"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="750" verticalCompressionResistancePriority="1000" text="name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="P7W-mu-9al">
|
||||
<rect key="frame" x="74" y="15" width="35.5" height="30"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.20000000000000001" green="0.20000000000000001" blue="0.20000000000000001" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<imageView clipsSubviews="YES" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="oOg-GY-xRe" userLabel="avatar" customClass="UMComImageView">
|
||||
<rect key="frame" x="15" y="15" width="44" height="44.5"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="MOL-o9-ERu"/>
|
||||
<constraint firstAttribute="width" constant="44" id="Yrt-pw-2Mh"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="22"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lro-ob-1aA" userLabel="icon">
|
||||
<rect key="frame" x="471" y="17" width="10" height="10"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="10" id="O9R-Yz-B8A"/>
|
||||
<constraint firstAttribute="height" constant="10" id="OP3-lx-6Au"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" horizontalCompressionResistancePriority="751" text="time" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="evk-4Q-r9C" userLabel="time">
|
||||
<rect key="frame" x="486" y="15" width="23" height="13.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<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="yP7-vc-rrE" userLabel="text" customClass="UMComMutiStyleTextView">
|
||||
<rect key="frame" x="74" y="55" width="440" height="40"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" priority="999" constant="40" id="kQa-Ud-4pW"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" verticalHuggingPriority="1000" translatesAutoresizingMaskIntoConstraints="NO" id="MgZ-a2-H2r" userLabel="pic_comment">
|
||||
<rect key="frame" x="15" y="110" width="494" height="80"/>
|
||||
<subviews>
|
||||
<imageView contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="zje-kP-EYA" userLabel="co_pic" customClass="UMComImageView">
|
||||
<rect key="frame" x="10" y="10" width="60" height="60"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="60" id="44U-7G-2da"/>
|
||||
<constraint firstAttribute="height" relation="lessThanOrEqual" constant="60" id="Nu7-Jf-fOF"/>
|
||||
<constraint firstAttribute="height" constant="60" id="cBf-eL-ZCk"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="Nu7-Jf-fOF"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</imageView>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jtX-as-lpi" userLabel="co_content">
|
||||
<rect key="frame" x="80" y="9" width="414" height="61"/>
|
||||
<subviews>
|
||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KKP-Ha-Jfv" userLabel="co_name">
|
||||
<rect key="frame" x="10" y="10" width="35.5" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.27450980392156865" green="0.61960784313725492" blue="0.97254901960784312" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" verticalCompressionResistancePriority="1000" text="text" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yug-tL-IMH" userLabel="text">
|
||||
<rect key="frame" x="10" y="37" width="22" height="14.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" secondItem="yug-tL-IMH" secondAttribute="bottom" constant="10" id="088-yt-W0R"/>
|
||||
<constraint firstAttribute="bottom" secondItem="KKP-Ha-Jfv" secondAttribute="bottom" priority="750" constant="19.5" id="Krg-Mq-3bK"/>
|
||||
<constraint firstItem="yug-tL-IMH" firstAttribute="leading" secondItem="KKP-Ha-Jfv" secondAttribute="leading" id="NWB-np-w9O"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="yug-tL-IMH" secondAttribute="trailing" constant="10" id="Y0t-oH-NLj"/>
|
||||
<constraint firstItem="KKP-Ha-Jfv" firstAttribute="top" secondItem="jtX-as-lpi" secondAttribute="top" constant="10" id="hSK-3Z-F8Y"/>
|
||||
<constraint firstItem="yug-tL-IMH" firstAttribute="top" secondItem="KKP-Ha-Jfv" secondAttribute="bottom" constant="10" id="i3I-3h-yr2"/>
|
||||
<constraint firstItem="KKP-Ha-Jfv" firstAttribute="leading" secondItem="jtX-as-lpi" secondAttribute="leading" constant="10" id="jDD-lD-U7D"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="KKP-Ha-Jfv" secondAttribute="trailing" constant="10" id="xP7-yE-AqI"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.96470588235294119" green="0.96862745098039216" blue="0.97647058823529409" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="80" id="3nU-sZ-Aag"/>
|
||||
<constraint firstItem="jtX-as-lpi" firstAttribute="leading" secondItem="zje-kP-EYA" secondAttribute="trailing" constant="10" id="Sa6-aa-bno"/>
|
||||
<constraint firstItem="zje-kP-EYA" firstAttribute="top" secondItem="MgZ-a2-H2r" secondAttribute="top" constant="10" id="Xta-Yt-Dvv"/>
|
||||
<constraint firstItem="zje-kP-EYA" firstAttribute="leading" secondItem="MgZ-a2-H2r" secondAttribute="leading" constant="10" id="efS-bG-6PS"/>
|
||||
<constraint firstItem="jtX-as-lpi" firstAttribute="centerY" secondItem="zje-kP-EYA" secondAttribute="centerY" id="rM6-0K-wxi"/>
|
||||
<constraint firstAttribute="trailing" secondItem="jtX-as-lpi" secondAttribute="trailing" id="xxz-QR-yLV"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="lK5-ja-5Av" userLabel="txt_comment">
|
||||
<rect key="frame" x="15" y="110" width="494" height="46"/>
|
||||
<subviews>
|
||||
<label opaque="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="750" text="name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JJ3-b3-VQM" userLabel="name">
|
||||
<rect key="frame" x="15" y="15" width="33.5" height="16"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="200" id="Cwc-1q-sye"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="13"/>
|
||||
<color key="textColor" red="0.27450980392156865" green="0.61960784313725492" blue="0.97254901960784312" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" horizontalCompressionResistancePriority="749" text="text" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="lcD-zx-CVw" userLabel="text">
|
||||
<rect key="frame" x="48" y="16" width="22" height="14.5"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="12"/>
|
||||
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" red="0.96470588235294119" green="0.96862745098039216" blue="0.97647058823529409" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<constraints>
|
||||
<constraint firstItem="lcD-zx-CVw" firstAttribute="leading" secondItem="JJ3-b3-VQM" secondAttribute="trailing" id="0b5-H3-ERa"/>
|
||||
<constraint firstAttribute="bottom" secondItem="JJ3-b3-VQM" secondAttribute="bottom" constant="15" identifier="t_t_b" id="CW4-iP-hh2"/>
|
||||
<constraint firstItem="lcD-zx-CVw" firstAttribute="centerY" secondItem="JJ3-b3-VQM" secondAttribute="centerY" id="HH8-at-RRr"/>
|
||||
<constraint firstItem="JJ3-b3-VQM" firstAttribute="leading" secondItem="lK5-ja-5Av" secondAttribute="leading" constant="15" id="VoL-LE-R5H"/>
|
||||
<constraint firstAttribute="height" constant="46" id="jmn-Tw-ERF"/>
|
||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="lcD-zx-CVw" secondAttribute="trailing" constant="10" id="q0T-Aq-poI"/>
|
||||
<constraint firstItem="JJ3-b3-VQM" firstAttribute="top" secondItem="lK5-ja-5Av" secondAttribute="top" constant="15" id="vKJ-Dj-o4A"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="lro-ob-1aA" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="P7W-mu-9al" secondAttribute="trailing" constant="10" id="2u3-ga-gLq"/>
|
||||
<constraint firstItem="lro-ob-1aA" firstAttribute="centerY" secondItem="evk-4Q-r9C" secondAttribute="centerY" id="3fz-S8-D4d"/>
|
||||
<constraint firstItem="P7W-mu-9al" firstAttribute="leading" secondItem="oOg-GY-xRe" secondAttribute="trailing" constant="15" id="4S6-WM-a7X"/>
|
||||
<constraint firstItem="yP7-vc-rrE" firstAttribute="leading" secondItem="P7W-mu-9al" secondAttribute="leading" id="6ZP-T6-CQx"/>
|
||||
<constraint firstAttribute="trailing" secondItem="MgZ-a2-H2r" secondAttribute="trailing" constant="15" id="7zB-FQ-Wna"/>
|
||||
<constraint firstItem="lK5-ja-5Av" firstAttribute="leading" secondItem="oOg-GY-xRe" secondAttribute="leading" id="8VM-H1-0EV"/>
|
||||
<constraint firstAttribute="bottom" secondItem="MgZ-a2-H2r" secondAttribute="bottom" constant="15" id="IRK-wC-gjH"/>
|
||||
<constraint firstItem="MgZ-a2-H2r" firstAttribute="leading" secondItem="oOg-GY-xRe" secondAttribute="leading" id="JWw-tH-9Kb"/>
|
||||
<constraint firstItem="evk-4Q-r9C" firstAttribute="leading" secondItem="lro-ob-1aA" secondAttribute="trailing" constant="5" id="M7M-Wl-pMo"/>
|
||||
<constraint firstItem="yP7-vc-rrE" firstAttribute="top" secondItem="P7W-mu-9al" secondAttribute="bottom" constant="10" id="Mjl-mk-YTs"/>
|
||||
<constraint firstAttribute="bottom" secondItem="lK5-ja-5Av" secondAttribute="bottom" priority="750" constant="15" id="P5S-In-xTz"/>
|
||||
<constraint firstItem="MgZ-a2-H2r" firstAttribute="leading" secondItem="qg8-79-2dp" secondAttribute="leading" constant="15" id="Pnd-Wh-Edd"/>
|
||||
<constraint firstItem="oOg-GY-xRe" firstAttribute="leading" secondItem="qg8-79-2dp" secondAttribute="leading" constant="15" id="UIE-E6-pIn"/>
|
||||
<constraint firstItem="lK5-ja-5Av" firstAttribute="top" secondItem="yP7-vc-rrE" secondAttribute="bottom" constant="15" identifier="t_2_c" id="WoZ-hp-mq5"/>
|
||||
<constraint firstItem="evk-4Q-r9C" firstAttribute="top" secondItem="qg8-79-2dp" secondAttribute="top" constant="15" id="Xk0-dC-L02"/>
|
||||
<constraint firstAttribute="bottom" secondItem="yP7-vc-rrE" secondAttribute="bottom" constant="110" id="blc-AM-2Ys"/>
|
||||
<constraint firstItem="oOg-GY-xRe" firstAttribute="top" secondItem="qg8-79-2dp" secondAttribute="top" constant="15" id="cuK-ya-7k4"/>
|
||||
<constraint firstItem="MgZ-a2-H2r" firstAttribute="top" secondItem="yP7-vc-rrE" secondAttribute="bottom" constant="15" id="gbn-Kg-XgP"/>
|
||||
<constraint firstItem="lK5-ja-5Av" firstAttribute="top" secondItem="oOg-GY-xRe" secondAttribute="bottom" priority="750" constant="15" id="hW4-8E-CfQ"/>
|
||||
<constraint firstAttribute="trailing" secondItem="lK5-ja-5Av" secondAttribute="trailing" constant="15" id="jWA-w4-R24"/>
|
||||
<constraint firstAttribute="trailing" secondItem="evk-4Q-r9C" secondAttribute="trailing" constant="15" id="nX2-cN-cua"/>
|
||||
<constraint firstItem="MgZ-a2-H2r" firstAttribute="top" secondItem="oOg-GY-xRe" secondAttribute="bottom" priority="750" constant="15" id="sa2-nD-mYx"/>
|
||||
<constraint firstItem="P7W-mu-9al" firstAttribute="top" secondItem="oOg-GY-xRe" secondAttribute="top" id="t02-ou-fKc"/>
|
||||
<constraint firstAttribute="trailing" secondItem="yP7-vc-rrE" secondAttribute="trailing" constant="10" id="tk8-94-9ze"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
<exclude reference="blc-AM-2Ys"/>
|
||||
<exclude reference="Pnd-Wh-Edd"/>
|
||||
</mask>
|
||||
</variation>
|
||||
</view>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="qg8-79-2dp" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="VED-yf-j7r"/>
|
||||
<constraint firstAttribute="bottom" secondItem="qg8-79-2dp" secondAttribute="bottom" id="qRq-hb-KgO"/>
|
||||
<constraint firstItem="qg8-79-2dp" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="10" id="qgl-4j-AXK"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qg8-79-2dp" secondAttribute="trailing" id="uBW-Ys-dE2"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<connections>
|
||||
<outlet property="cardView" destination="qg8-79-2dp" id="9AY-CM-xsI"/>
|
||||
<outlet property="commentLabel" destination="yP7-vc-rrE" id="NdE-MR-IJm"/>
|
||||
<outlet property="creatorAvatar" destination="oOg-GY-xRe" id="VOp-qw-tb8"/>
|
||||
<outlet property="creatorNameLabel" destination="P7W-mu-9al" id="j7B-Tp-9Lh"/>
|
||||
<outlet property="feedCreatorNameLabel" destination="KKP-Ha-Jfv" id="Cvk-Jm-u11"/>
|
||||
<outlet property="feedImageView" destination="zje-kP-EYA" id="tQZ-op-HaH"/>
|
||||
<outlet property="feedTextLabel" destination="yug-tL-IMH" id="dci-x2-4WZ"/>
|
||||
<outlet property="picFeedView" destination="MgZ-a2-H2r" id="Mrn-OF-qrn"/>
|
||||
<outlet property="textFeedCreatorNameLabel" destination="JJ3-b3-VQM" id="1R0-1Q-3ah"/>
|
||||
<outlet property="textFeedTextLabel" destination="lcD-zx-CVw" id="erE-Xt-hjq"/>
|
||||
<outlet property="textFeedView" destination="lK5-ja-5Av" id="bpK-Gb-JNk"/>
|
||||
<outlet property="timeIcon" destination="lro-ob-1aA" id="Muz-LY-Z7n"/>
|
||||
<outlet property="timeLabel" destination="evk-4Q-r9C" id="rFl-io-ERv"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="153" y="-213"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
</document>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// UMComSimpleCommentViewController.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/25/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComViewController.h"
|
||||
|
||||
@interface UMComSimpleCommentViewController : UMComViewController
|
||||
|
||||
@end
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
//
|
||||
// UMComSimpleCommentViewController.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/25/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSimpleCommentViewController.h"
|
||||
#import "UIViewController+UMComAddition.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import "UMComSimpleSubCommentViewController.h"
|
||||
#import "UMComCommentListDataController.h"
|
||||
#import "UMComFeedClickActionDelegate.h"
|
||||
#import "UMComSimpleFeedDetailViewController.h"
|
||||
#import "UMComSimplicityUserCenterViewController.h"
|
||||
#import <UMCommunitySDK/UMComSession.h>
|
||||
#import <UMComDataStorage/UMComUnReadNoticeModel.h>
|
||||
#import "UMComWebViewController.h"
|
||||
#import <UMComDataStorage/UMComModelObjectHeader.h>
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
@interface UMComSimpleCommentViewController ()
|
||||
<UMComFeedClickActionDelegate>
|
||||
|
||||
@property (nonatomic, strong) UIButton *sentCommentButton;
|
||||
@property (nonatomic, strong) UIButton *receivedCommentButton;
|
||||
@property (nonatomic, strong) CALayer *lineLayer;
|
||||
@property (nonatomic, weak) UIViewController *currentVC;
|
||||
|
||||
@property (nonatomic, strong) UMComSimpleSubCommentViewController *sentCommentVC;
|
||||
@property (nonatomic, strong) UMComSimpleSubCommentViewController *receivedCommentVC;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComSimpleCommentViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
|
||||
[self setForumUITitle:UMComLocalizedString(@"um_com_my_comment", @"评论")];
|
||||
|
||||
[self initButton];
|
||||
|
||||
[self initController];
|
||||
|
||||
[self switchToReceivedComment];
|
||||
self.view.backgroundColor = UMComColorWithHexString(@"#e8eaee");
|
||||
|
||||
[UMComSession sharedInstance].unReadNoticeModel.notiByCommentCount = 0;
|
||||
}
|
||||
|
||||
- (void)initButton
|
||||
{
|
||||
self.sentCommentButton = [self getButtonWithName:UMComLocalizedString(@"um_com_sent_comment", @"发出的评论") selector:@selector(switchToSentComment)];
|
||||
CGSize viewSize = self.view.frame.size;
|
||||
_sentCommentButton.frame = CGRectMake(viewSize.width / 2.f, 0.f, viewSize.width / 2.f, 44.f);
|
||||
|
||||
self.receivedCommentButton = [self getButtonWithName:UMComLocalizedString(@"um_com_received_comment", @"收到的评论") selector:@selector(switchToReceivedComment)];
|
||||
_receivedCommentButton.frame = CGRectMake(0.f, 0.f, viewSize.width / 2.f, 44.f);
|
||||
|
||||
CALayer *bottomLineLayer = [[CALayer alloc] init];
|
||||
bottomLineLayer.backgroundColor = UMComColorWithHexString(@"#dfdfdf").CGColor;
|
||||
bottomLineLayer.frame = CGRectMake(0.f, _sentCommentButton.frame.size.height - 1.f, viewSize.width, 1.f);
|
||||
|
||||
self.lineLayer = [[CALayer alloc] init];
|
||||
_lineLayer.frame = CGRectMake(0.f, _sentCommentButton.frame.size.height - 2.f, viewSize.width / 2.f, 2.f);
|
||||
_lineLayer.backgroundColor = UMComColorWithHexString(@"469ef8").CGColor;
|
||||
|
||||
[self.view addSubview:_sentCommentButton];
|
||||
[self.view addSubview:_receivedCommentButton];
|
||||
|
||||
[self.view.layer addSublayer:bottomLineLayer];
|
||||
|
||||
[self.view.layer addSublayer:_lineLayer];
|
||||
}
|
||||
|
||||
- (void)initController
|
||||
{
|
||||
self.sentCommentVC = [[UMComSimpleSubCommentViewController alloc] init];
|
||||
UMComUserSentCommentListDataController* sentCommentDataContrller = [[UMComUserSentCommentListDataController alloc] initWithCount:UMCom_Limit_Page_Count];
|
||||
sentCommentDataContrller.pageRequestType = UMComRequestType_UserSendComment;
|
||||
_sentCommentVC.dataController = sentCommentDataContrller;
|
||||
_sentCommentVC.delegate = self;
|
||||
[self addChildViewController:_sentCommentVC];
|
||||
|
||||
self.receivedCommentVC = [[UMComSimpleSubCommentViewController alloc] init];
|
||||
UMComUserReceivedCommentListDataController* receivedCommentListDataController = [[UMComUserReceivedCommentListDataController alloc] initWithCount:UMCom_Limit_Page_Count];
|
||||
receivedCommentListDataController.pageRequestType = UMComRequestType_UserReceiveComment;
|
||||
_receivedCommentVC.dataController = receivedCommentListDataController;
|
||||
_receivedCommentVC.delegate = self;
|
||||
[self addChildViewController:_receivedCommentVC];
|
||||
}
|
||||
|
||||
- (void)constraintControllerView:(UIView *)view withHeight:(CGFloat)height
|
||||
{
|
||||
[view setTranslatesAutoresizingMaskIntoConstraints:NO];
|
||||
NSDictionary *dict1 = NSDictionaryOfVariableBindings(view);
|
||||
NSDictionary *metrics = @{@"hPadding":@0,@"vPadding":@0,@"buttonPadding":[NSNumber numberWithFloat:height]};
|
||||
NSString *vfl = @"|-hPadding-[view]-hPadding-|";
|
||||
NSString *vfl0 = @"V:|-buttonPadding-[view]-vPadding-|";
|
||||
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:vfl options:0 metrics:metrics views:dict1]];
|
||||
[self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:vfl0 options:0 metrics:metrics views:dict1]];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
- (UIButton *)getButtonWithName:(NSString *)name selector:(SEL)sel
|
||||
{
|
||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[button setTitle:name forState:UIControlStateNormal];
|
||||
[button setTitleColor:UMComColorWithHexString(@"999999") forState:UIControlStateNormal];
|
||||
[button setTitleColor:UMComColorWithHexString(@"469ef8") forState:UIControlStateSelected];
|
||||
[button setTitleColor:UMComColorWithHexString(@"469ef8") forState:UIControlStateHighlighted];
|
||||
[button setBackgroundColor:[UIColor whiteColor]];
|
||||
[button.titleLabel setFont:UMComFontNotoSansLightWithSafeSize(14.f)];
|
||||
[button addTarget:self action:sel forControlEvents:UIControlEventTouchUpInside];
|
||||
return button;
|
||||
}
|
||||
|
||||
- (void)switchToSentComment
|
||||
{
|
||||
_sentCommentButton.selected = YES;
|
||||
_receivedCommentButton.selected = NO;
|
||||
CGRect frame = _lineLayer.frame;
|
||||
frame.origin.x = _sentCommentButton.frame.origin.x;
|
||||
_lineLayer.frame = frame;
|
||||
|
||||
[self switchFromVC:_receivedCommentVC toVC:_sentCommentVC];
|
||||
}
|
||||
|
||||
- (void)switchToReceivedComment
|
||||
{
|
||||
_sentCommentButton.selected = NO;
|
||||
_receivedCommentButton.selected = YES;
|
||||
CGRect frame = _lineLayer.frame;
|
||||
frame.origin.x = _receivedCommentButton.frame.origin.x;
|
||||
_lineLayer.frame = frame;
|
||||
|
||||
[self switchFromVC:_sentCommentVC toVC:_receivedCommentVC];
|
||||
}
|
||||
|
||||
- (void)switchFromVC:(UIViewController *)fromVC toVC:(UIViewController *)toVC
|
||||
{
|
||||
if (_currentVC == toVC) {
|
||||
return;
|
||||
}
|
||||
[self addChildViewController:toVC];
|
||||
[fromVC willMoveToParentViewController:nil];
|
||||
|
||||
__weak typeof(self) ws = self;
|
||||
[self transitionFromViewController:fromVC toViewController:toVC duration:.2f options:UIViewAnimationOptionTransitionNone animations:^{
|
||||
[self.view addSubview:toVC.view];
|
||||
[self constraintControllerView:toVC.view withHeight:_sentCommentButton.frame.size.height];
|
||||
} completion:^(BOOL finished) {
|
||||
if (finished) {
|
||||
[fromVC.view removeFromSuperview];
|
||||
[fromVC removeFromParentViewController];
|
||||
[toVC didMoveToParentViewController:ws];
|
||||
ws.currentVC = toVC;
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - actionDeleagte
|
||||
- (void)customObj:(id)obj clickOnFeedText:(UMComFeed *)feed
|
||||
{
|
||||
if (![feed isKindOfClass:[UMComFeed class]]) {
|
||||
return;
|
||||
}
|
||||
if ([feed.status isKindOfClass:[NSNumber class]] && feed.status.integerValue >= 2) {
|
||||
//代表feed被删除
|
||||
return;
|
||||
}
|
||||
UMComSimpleFeedDetailViewController *detailVc = [[UMComSimpleFeedDetailViewController alloc] init];
|
||||
detailVc.feed = feed;
|
||||
[self.navigationController pushViewController:detailVc animated:YES];
|
||||
}
|
||||
|
||||
- (void)customObj:(id)obj clickOnFeedCreator:(UMComUser *)user;
|
||||
{
|
||||
UMComSimplicityUserCenterViewController *userCenterVc = [[UMComSimplicityUserCenterViewController alloc] init];
|
||||
userCenterVc.user = user;
|
||||
[self.navigationController pushViewController:userCenterVc animated:YES];
|
||||
}
|
||||
|
||||
- (void)customObj:(id)obj clickOnURL:(NSString *)urlSring
|
||||
{
|
||||
UMComWebViewController *webVC = [[UMComWebViewController alloc] initWithUrl:urlSring];
|
||||
[self.navigationController pushViewController:webVC animated:YES];
|
||||
}
|
||||
|
||||
- (void)customObj:(id)obj clickOnImageView:(UIImageView *)imageView complitionBlock:(void (^)(UIViewController *currentViewController))block
|
||||
{
|
||||
if (block) {
|
||||
block(self);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// UMComBeLikedFeedViewController.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/19/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComRequestTableViewController.h"
|
||||
|
||||
@interface UMComSimpleLikeMyFeedViewController : UMComRequestTableViewController
|
||||
|
||||
@end
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
//
|
||||
// UMComBeLikedFeedViewController.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/19/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSimpleLikeMyFeedViewController.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import "UIViewController+UMComAddition.h"
|
||||
#import "UMComSimpleFeedDetailViewController.h"
|
||||
#import "UMComSimpleAssociatedFeedTableViewCell.h"
|
||||
#import "UMComFeedClickActionDelegate.h"
|
||||
#import "UMComUserListDataController.h"
|
||||
#import "UMComSimplicityUserCenterViewController.h"
|
||||
#import <UMComDataStorage/UMComLike.h>
|
||||
#import <UMCommunitySDK/UMComSession.h>
|
||||
#import <UMComDataStorage/UMComUnReadNoticeModel.h>
|
||||
#import "UMComLikeListDataController.h"
|
||||
#import <UMComDataStorage/UMComModelObjectHeader.h>
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
|
||||
@interface UMComSimpleLikeMyFeedViewController ()<UITableViewDataSource, UITableViewDelegate, UMComFeedClickActionDelegate>
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary *cellCacheDict;
|
||||
|
||||
@property (nonatomic, strong) UMComSimpleAssociatedFeedTableViewCell *baseCell;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComSimpleLikeMyFeedViewController
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.dataController = [[UMComUserReceivedLikeDataController alloc] initWithCount:UMCom_Limit_Page_Count];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
||||
[self setForumUITitle:UMComLocalizedString(@"um_com_be_liked_feed", @"赞我的")];
|
||||
|
||||
UINib *cellNib = [UINib nibWithNibName:kUMComSimpleAssociatedFeedTableViewCellName bundle:nil];
|
||||
[self.tableView registerNib:cellNib forCellReuseIdentifier:kUMComSimpleAssociatedFeedTableViewCellId];
|
||||
|
||||
_baseCell = [cellNib instantiateWithOwner:nil options:nil][0];
|
||||
|
||||
self.cellCacheDict = [NSMutableDictionary dictionary];
|
||||
self.isLoadFinish = YES;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.view.backgroundColor = UMComColorWithHexString(@"e8eaee");
|
||||
|
||||
[UMComSession sharedInstance].unReadNoticeModel.notiByLikeCount = 0;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
#pragma mark - tableview
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return [super tableView:tableView numberOfRowsInSection:section];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UMComLike *like = self.dataController.dataArray[indexPath.row];
|
||||
|
||||
UMComSimpleAssociatedFeedTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kUMComSimpleAssociatedFeedTableViewCellId];
|
||||
|
||||
cell.bounds = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.tableView.bounds), CGRectGetHeight(_baseCell.bounds));
|
||||
|
||||
[cell setNeedsLayout];
|
||||
[cell layoutIfNeeded];
|
||||
|
||||
cell.delegate = self;
|
||||
[cell refreshWithBeLiked:like];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
|
||||
NSString *heightKey = [NSString stringWithFormat:@"height_%d",(int)indexPath.row];
|
||||
|
||||
CGFloat height = 0;
|
||||
if (![self.cellCacheDict valueForKey:heightKey] ) {
|
||||
UMComSimpleAssociatedFeedTableViewCell *cell = self.baseCell;
|
||||
|
||||
UMComLike *like = self.dataController.dataArray[indexPath.row];
|
||||
|
||||
cell.bounds = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.tableView.bounds), CGRectGetHeight(_baseCell.bounds));
|
||||
|
||||
[cell setNeedsLayout];
|
||||
[cell layoutIfNeeded];
|
||||
|
||||
[cell refreshWithBeLiked:like];
|
||||
|
||||
height = [cell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
|
||||
height += 1;
|
||||
[self.cellCacheDict setValue:@(height) forKey:heightKey];
|
||||
}else{
|
||||
height = [[self.cellCacheDict valueForKey:heightKey] floatValue];
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
#pragma mark - actionDeleagte
|
||||
- (void)customObj:(id)obj clickOnFeedText:(UMComFeed *)feed
|
||||
{
|
||||
if (![feed isKindOfClass:[UMComFeed class]]) {
|
||||
return;
|
||||
}
|
||||
if ([feed.status isKindOfClass:[NSNumber class]] && feed.status.integerValue >= 2) {
|
||||
//代表feed被删除
|
||||
return;
|
||||
}
|
||||
UMComSimpleFeedDetailViewController *detailVc = [[UMComSimpleFeedDetailViewController alloc] init];
|
||||
detailVc.feed = feed;
|
||||
[self.navigationController pushViewController:detailVc animated:YES];
|
||||
}
|
||||
|
||||
- (void)customObj:(id)obj clickOnFeedCreator:(UMComUser *)user;
|
||||
{
|
||||
UMComSimplicityUserCenterViewController *userCenterVc = [[UMComSimplicityUserCenterViewController alloc] init];
|
||||
userCenterVc.user = user;
|
||||
[self.navigationController pushViewController:userCenterVc animated:YES];
|
||||
}
|
||||
|
||||
- (void)customObj:(id)obj clickOnImageView:(UIImageView *)imageView complitionBlock:(void (^)(UIViewController *currentViewController))block
|
||||
{
|
||||
if (block) {
|
||||
block(self);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// UMComSimpleNoticeTableViewController.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/17.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComRequestTableViewController.h"
|
||||
|
||||
@interface UMComSimpleNoticeTableViewController : UMComRequestTableViewController
|
||||
|
||||
@end
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
//
|
||||
// UMComSimpleNoticeTableViewController.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/17.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSimpleNoticeTableViewController.h"
|
||||
#import "UMComSimpleNotificationCell.h"
|
||||
#import "UMComNoticeListDataController.h"
|
||||
#import <UMComDataStorage/UMComNotification.h>
|
||||
#import "UIViewController+UMComAddition.h"
|
||||
#import <UMComDataStorage/UMComUser.h>
|
||||
#import <UMCommunitySDK/UMComSession.h>
|
||||
#import <UMComDataStorage/UMComUnReadNoticeModel.h>
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
#import "UMComResouceDefines.h"
|
||||
#import "UMComSimplicityUserCenterViewController.h"
|
||||
|
||||
static NSString *kUMComSimpleNotificationCellID = @"UMComSimpleNotificationCell";
|
||||
|
||||
@interface UMComSimpleNoticeTableViewController ()
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary *cellHeightDict;
|
||||
|
||||
@property (nonatomic, strong) UMComSimpleNotificationCell *baseCell;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@implementation UMComSimpleNoticeTableViewController
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self setForumUITitle:UMComLocalizedString(@"um_com_notification", @"通知")];
|
||||
|
||||
UINib *cellNib = [UINib nibWithNibName:kUMComSimpleNotificationCellName bundle:nil];
|
||||
[self.tableView registerNib:cellNib forCellReuseIdentifier:kUMComSimpleNotificationCellID];
|
||||
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
self.tableView.rowHeight = 203;
|
||||
|
||||
|
||||
self.cellHeightDict = [NSMutableDictionary dictionary];
|
||||
|
||||
self.dataController = [[UMComNoticeListDataController alloc] initWithCount:UMCom_Limit_Page_Count];
|
||||
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.view.backgroundColor = UMComColorWithHexString(@"#e8eaee");
|
||||
|
||||
[UMComSession sharedInstance].unReadNoticeModel.notiByAdministratorCount = 0;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
}
|
||||
|
||||
- (void)viewDidAppear:(BOOL)animated
|
||||
{
|
||||
[super viewDidAppear:animated];
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return [super tableView:tableView numberOfRowsInSection:section];
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UMComSimpleNotificationCell *cell = [tableView dequeueReusableCellWithIdentifier:kUMComSimpleNotificationCellID];
|
||||
__weak typeof(self) weakSelf = self;
|
||||
cell.tapAvatorAction = ^(UMComNotification *notification){
|
||||
UMComSimplicityUserCenterViewController *userCenter = [[UMComSimplicityUserCenterViewController alloc] init];
|
||||
[weakSelf.navigationController pushViewController:userCenter animated:YES];
|
||||
};
|
||||
UMComNotification* notice = self.dataController.dataArray[indexPath.row];
|
||||
[cell reloadCellWithNotification:notice];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
|
||||
UMComNotification* notice = self.dataController.dataArray[indexPath.row];
|
||||
NSString *heightKey = notice.id;
|
||||
CGFloat height = 0;
|
||||
if ([self.cellHeightDict valueForKey:heightKey]) {
|
||||
height = [[self.cellHeightDict valueForKey:heightKey] floatValue];
|
||||
}else{
|
||||
if (!_baseCell) {
|
||||
NSArray *array = [[NSBundle mainBundle] loadNibNamed:kUMComSimpleNotificationCellName owner:self options:nil];
|
||||
self.baseCell = [array objectAtIndex:0];
|
||||
_baseCell.bounds = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.tableView.bounds), CGRectGetHeight(_baseCell.bounds));
|
||||
}
|
||||
[_baseCell setNeedsLayout];
|
||||
[_baseCell layoutIfNeeded];
|
||||
[_baseCell reloadCellWithNotification:notice];
|
||||
height = [_baseCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
|
||||
height += 1;
|
||||
[self.cellHeightDict setValue:@(height) forKey:heightKey];
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// UMComSimpleNotificationCell.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/17.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
static NSString *kUMComSimpleNotificationCellName = @"UMComSimpleNotificationCell";
|
||||
|
||||
@class UMComNotification, UMComLabel;
|
||||
|
||||
@interface UMComSimpleNotificationCell : UITableViewCell
|
||||
|
||||
@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 UMComLabel *contentLabel;
|
||||
|
||||
@property (nonatomic, copy) void (^tapAvatorAction)(UMComNotification *notification);
|
||||
|
||||
- (void)reloadCellWithNotification:(UMComNotification *)notification;
|
||||
|
||||
@end
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
//
|
||||
// UMComSimpleNotificationCell.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 16/5/17.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSimpleNotificationCell.h"
|
||||
#import <UMComDataStorage/UMComNotification.h>
|
||||
#import <UMComDataStorage/UMComUser.h>
|
||||
#import "UMComLabel.h"
|
||||
#import <UMComDataStorage/UMComImageUrl.h>
|
||||
#import "UMComResouceDefines.h"
|
||||
#import "UMComAvatarImageView.h"
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
@interface UMComSimpleNotificationCell ()
|
||||
|
||||
@property (nonatomic, strong) UMComAvatarImageView *realAvatar;
|
||||
|
||||
@property (nonatomic, strong) UMComNotification *notification;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComSimpleNotificationCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
|
||||
self.dateIcon.image = UMComSimpleImageWithImageName(@"um_time");
|
||||
self.realAvatar = [UMComAvatarImageView filletAvatarWithFrame:self.avatorImageView.bounds];
|
||||
self.realAvatar.userInteractionEnabled = YES;
|
||||
self.avatorImageView.userInteractionEnabled = YES;
|
||||
[self.avatorImageView addSubview:_realAvatar];
|
||||
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapInAvator)];
|
||||
[self.realAvatar addGestureRecognizer:tap];
|
||||
|
||||
self.customBgView.layer.borderColor = UMComColorWithHexString(@"#dfdfdf").CGColor;
|
||||
self.customBgView.layer.borderWidth = 1.f;
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
|
||||
self.contentLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.contentLabel.frame);
|
||||
self.contentLabel.lineSpace = 2;
|
||||
}
|
||||
|
||||
- (void)didTapInAvator
|
||||
{
|
||||
if (self.tapAvatorAction) {
|
||||
self.tapAvatorAction(self.notification);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)reloadCellWithNotification:(UMComNotification *)notification
|
||||
{
|
||||
self.notification = notification;
|
||||
self.nameLabel.text = notification.creator.name;
|
||||
self.dateLabel.text = createTimeString(notification.create_time);
|
||||
[self.realAvatar resetAvatarWithUser:notification.creator];
|
||||
self.contentLabel.textForAttribute = notification.content;
|
||||
//更新约束
|
||||
[self.contentLabel updateConstraintsIfNeeded];
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
|
||||
[self.customBgView setNeedsLayout];
|
||||
[self.customBgView layoutIfNeeded];
|
||||
|
||||
[self.contentView setNeedsLayout];
|
||||
[self.contentView layoutIfNeeded];
|
||||
|
||||
self.contentLabel.preferredMaxLayoutWidth = CGRectGetWidth(self.contentLabel.frame);
|
||||
}
|
||||
@end
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
<?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="UMComSimpleNotificationCell" selectionStyle="default" indentationWidth="10" reuseIdentifier="UMComSimpleNotificationCell" rowHeight="203" id="KGk-i7-Jjw" customClass="UMComSimpleNotificationCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="203"/>
|
||||
<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="202"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Dn-pf-KAc" userLabel="customBgView">
|
||||
<rect key="frame" x="0.0" y="5" width="320" height="192"/>
|
||||
<subviews>
|
||||
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="6s9-dH-6Jv" userLabel="avatorImageView">
|
||||
<rect key="frame" x="15" y="15" width="44" height="44"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="44" id="INj-cu-XnQ"/>
|
||||
<constraint firstAttribute="width" constant="44" id="x6n-WG-YVM"/>
|
||||
</constraints>
|
||||
<userDefinedRuntimeAttributes>
|
||||
<userDefinedRuntimeAttribute type="number" keyPath="layer.cornerRadius">
|
||||
<integer key="value" value="22"/>
|
||||
</userDefinedRuntimeAttribute>
|
||||
</userDefinedRuntimeAttributes>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="name" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iOx-ga-EHd" userLabel="nameLabel">
|
||||
<rect key="frame" x="69" y="15" width="236" height="17"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="14"/>
|
||||
<color key="textColor" red="0.27450980392156865" green="0.61960784313725492" blue="0.97254901960784312" 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="1hE-46-pQ6" userLabel="dateIcon">
|
||||
<rect key="frame" x="69" y="42" width="14" height="14"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="14" id="do4-zg-FvQ"/>
|
||||
<constraint firstAttribute="width" constant="14" id="jRr-tp-Sey"/>
|
||||
</constraints>
|
||||
</imageView>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="date" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qgG-SM-x07" userLabel="dateLabel">
|
||||
<rect key="frame" x="91" y="42" width="216" height="14"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="height" constant="14" id="Joi-zV-qok"/>
|
||||
</constraints>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="11"/>
|
||||
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="1000" verticalCompressionResistancePriority="1000" text="label" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="qDO-t7-Roy" userLabel="contentLabel" customClass="UMComLabel">
|
||||
<rect key="frame" x="15" y="69" width="290" height="113"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="14"/>
|
||||
<color key="textColor" red="0.40000000000000002" green="0.40000000000000002" blue="0.40000000000000002" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
<size key="shadowOffset" width="0.0" height="0.0"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstItem="iOx-ga-EHd" firstAttribute="leading" secondItem="6s9-dH-6Jv" secondAttribute="trailing" constant="10" id="1oV-PJ-91w"/>
|
||||
<constraint firstItem="qDO-t7-Roy" firstAttribute="leading" secondItem="6Dn-pf-KAc" secondAttribute="leading" constant="15" id="2wn-5s-CcV"/>
|
||||
<constraint firstItem="1hE-46-pQ6" firstAttribute="leading" secondItem="6s9-dH-6Jv" secondAttribute="trailing" constant="10" id="3EJ-At-iEb"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qgG-SM-x07" secondAttribute="trailing" constant="13" id="6Al-nK-P9a"/>
|
||||
<constraint firstAttribute="trailing" secondItem="qDO-t7-Roy" secondAttribute="trailing" constant="15" id="9PU-kI-fG1"/>
|
||||
<constraint firstItem="qDO-t7-Roy" firstAttribute="top" secondItem="6s9-dH-6Jv" secondAttribute="bottom" constant="10" id="B6o-zI-AS0"/>
|
||||
<constraint firstItem="6s9-dH-6Jv" firstAttribute="top" secondItem="6Dn-pf-KAc" secondAttribute="top" constant="15" id="HWU-NO-5IM"/>
|
||||
<constraint firstItem="qgG-SM-x07" firstAttribute="centerY" secondItem="1hE-46-pQ6" secondAttribute="centerY" id="Jf4-nr-GHP"/>
|
||||
<constraint firstItem="6s9-dH-6Jv" firstAttribute="leading" secondItem="6Dn-pf-KAc" secondAttribute="leading" constant="15" id="e5n-ZZ-eww"/>
|
||||
<constraint firstAttribute="trailing" secondItem="iOx-ga-EHd" secondAttribute="trailing" constant="15" id="foD-Ah-x1g"/>
|
||||
<constraint firstItem="qgG-SM-x07" firstAttribute="leading" secondItem="1hE-46-pQ6" secondAttribute="trailing" constant="8" id="fvO-6a-Hp8"/>
|
||||
<constraint firstItem="1hE-46-pQ6" firstAttribute="top" secondItem="iOx-ga-EHd" secondAttribute="bottom" constant="10" id="iCV-XF-Gjt"/>
|
||||
<constraint firstAttribute="bottom" secondItem="qDO-t7-Roy" secondAttribute="bottom" constant="10" id="uH3-ep-GmO"/>
|
||||
<constraint firstItem="iOx-ga-EHd" firstAttribute="top" secondItem="6s9-dH-6Jv" secondAttribute="top" id="z9I-Ao-B19"/>
|
||||
</constraints>
|
||||
</view>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="trailing" secondItem="6Dn-pf-KAc" secondAttribute="trailing" id="45m-Wd-WZ0"/>
|
||||
<constraint firstAttribute="bottom" secondItem="6Dn-pf-KAc" secondAttribute="bottom" constant="5" id="auV-uY-rz7"/>
|
||||
<constraint firstItem="6Dn-pf-KAc" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="snr-9X-xId"/>
|
||||
<constraint firstItem="6Dn-pf-KAc" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="5" id="zL2-zl-dis"/>
|
||||
</constraints>
|
||||
</tableViewCellContentView>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<connections>
|
||||
<outlet property="avatorImageView" destination="6s9-dH-6Jv" id="uQb-0j-bmS"/>
|
||||
<outlet property="contentLabel" destination="qDO-t7-Roy" id="KfW-eU-y95"/>
|
||||
<outlet property="customBgView" destination="6Dn-pf-KAc" id="gfu-rh-lWL"/>
|
||||
<outlet property="dateIcon" destination="1hE-46-pQ6" id="H8R-Gu-1zw"/>
|
||||
<outlet property="dateLabel" destination="qgG-SM-x07" id="1rv-Lo-HbT"/>
|
||||
<outlet property="nameLabel" destination="iOx-ga-EHd" id="ITd-7h-wwW"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="213" y="213.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="UMComSimpleSDKResources.bundle/images/um_time" width="75" height="75"/>
|
||||
</resources>
|
||||
</document>
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// UMComUserCommentViewController.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/19/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComRequestTableViewController.h"
|
||||
|
||||
@protocol UMComFeedClickActionDelegate;
|
||||
|
||||
@interface UMComSimpleSubCommentViewController : UMComRequestTableViewController
|
||||
|
||||
@property (nonatomic, weak) id<UMComFeedClickActionDelegate> delegate;
|
||||
|
||||
@end
|
||||
+111
@@ -0,0 +1,111 @@
|
||||
//
|
||||
// UMComUserCommentViewController.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by wyq.Cloudayc on 5/19/16.
|
||||
// Copyright © 2016 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSimpleSubCommentViewController.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import "UIViewController+UMComAddition.h"
|
||||
#import "UMComSimpleFeedDetailViewController.h"
|
||||
#import "UMComSimpleAssociatedFeedTableViewCell.h"
|
||||
#import "UMComFeedClickActionDelegate.h"
|
||||
#import <UMComDataStorage/UMComComment.h>
|
||||
|
||||
|
||||
@interface UMComSimpleSubCommentViewController ()<UITableViewDataSource, UITableViewDelegate, UMComFeedClickActionDelegate>
|
||||
@property (nonatomic, strong) UMComListDataController *secondDataController;
|
||||
|
||||
@property (nonatomic, strong) NSMutableDictionary *cellCacheDict;
|
||||
|
||||
@property (nonatomic, strong) UMComSimpleAssociatedFeedTableViewCell *baseCell;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComSimpleSubCommentViewController
|
||||
|
||||
- (instancetype)init
|
||||
{
|
||||
if (self = [super init]) {
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self setForumUITitle:UMComLocalizedString(@"um_com_my_comment", @"评论")];
|
||||
|
||||
UINib *cellNib = [UINib nibWithNibName:kUMComSimpleAssociatedFeedTableViewCellName bundle:nil];
|
||||
[self.tableView registerNib:cellNib forCellReuseIdentifier:kUMComSimpleAssociatedFeedTableViewCellId];
|
||||
|
||||
self.baseCell = [cellNib instantiateWithOwner:nil options:nil][0];
|
||||
|
||||
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
||||
|
||||
self.cellCacheDict = [NSMutableDictionary dictionary];
|
||||
self.isLoadFinish = YES;
|
||||
self.doNotShowNodataNote = NO;
|
||||
self.tableView.backgroundColor = [UIColor clearColor];
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - tableview
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
|
||||
{
|
||||
return self.dataController.dataArray.count;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UMComComment *obj = self.dataController.dataArray[indexPath.row];
|
||||
|
||||
UMComSimpleAssociatedFeedTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:kUMComSimpleAssociatedFeedTableViewCellId];
|
||||
cell.delegate = _delegate;
|
||||
|
||||
cell.bounds = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.tableView.bounds), CGRectGetHeight(_baseCell.bounds));
|
||||
|
||||
[cell setNeedsLayout];
|
||||
[cell layoutIfNeeded];
|
||||
|
||||
[cell refreshWithComment:obj];
|
||||
|
||||
return cell;
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
UMComComment *obj = self.dataController.dataArray[indexPath.row];
|
||||
|
||||
NSString *heightKey = [NSString stringWithFormat:@"height_%@",obj.commentID];
|
||||
|
||||
CGFloat height = 0;
|
||||
if (![self.cellCacheDict valueForKey:heightKey] ) {
|
||||
|
||||
_baseCell.bounds = CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.tableView.bounds), CGRectGetHeight(_baseCell.bounds));
|
||||
|
||||
[_baseCell setNeedsLayout];
|
||||
[_baseCell layoutIfNeeded];
|
||||
|
||||
[_baseCell refreshWithComment:obj];
|
||||
|
||||
height = [_baseCell.contentView systemLayoutSizeFittingSize:UILayoutFittingCompressedSize].height;
|
||||
height += 1;
|
||||
[self.cellCacheDict setValue:@(height) forKey:heightKey];
|
||||
}else{
|
||||
height = [[self.cellCacheDict valueForKey:heightKey] floatValue];
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user