Initial commit
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// UMComEditForwardView.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 15/11/20.
|
||||
// Copyright © 2015年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
@class UMComImageView, UMComEditTextView;
|
||||
@interface UMComEditForwardView : UIImageView
|
||||
|
||||
@property (nonatomic, strong) UMComEditTextView *forwardEditTextView;
|
||||
|
||||
@property (nonatomic, strong) UMComImageView *forwardImageView;
|
||||
|
||||
@property (nonatomic, strong) NSMutableArray *forwardCheckWords;
|
||||
|
||||
- (void)reloadViewsWithText:(NSString *)text checkWords:(NSArray *)checkWords urlString:(NSString *)urlString;
|
||||
|
||||
/**
|
||||
* 重新布局转发的内容
|
||||
*
|
||||
* @param forwardCreator 转发feed的作者
|
||||
* @param forwardContent 转发的内容
|
||||
* @param checkWords 需要检查的高亮关键词(比如:作者的名字等)
|
||||
* @param urlString 转发的图片
|
||||
*/
|
||||
- (void)reloadViewsWithForwardCreator:(NSString *)forwardCreator forwardContent:(NSString*)forwardContent checkWords:(NSArray *)checkWords urlString:(NSString *)urlString;
|
||||
@end
|
||||
@@ -0,0 +1,165 @@
|
||||
//
|
||||
// UMComEditForwardView.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 15/11/20.
|
||||
// Copyright © 2015年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComEditForwardView.h"
|
||||
#import "UMComImageView.h"
|
||||
#import "UMComEditTextView.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
const CGFloat g_UMComEditForwardView_LeftMargin = 15.f;//左边界的距离
|
||||
const CGFloat g_UMComEditForwardView_RightMargin = 15.f;//右边界的距离
|
||||
|
||||
const CGFloat g_UMComEditForwardView_forwardImageTopMargin = 11.f;//图片上边界距离
|
||||
const CGFloat g_UMComEditForwardView_forwardImageBottomMargin = 11.f;//图片下边界
|
||||
const CGFloat g_UMComEditForwardView_forwardImageHeight = 71;//图片高度
|
||||
const CGFloat g_UMComEditForwardView_forwardImageWidth = 71;//图片宽度
|
||||
|
||||
const CGFloat g_UMComEditForwardView_spaceBetweenImgAndText = 11;//图片和文本的间距
|
||||
|
||||
const CGFloat g_UMComEditForwardView_forwardCreatorTopMargin = 15;//@feed作者的上边距
|
||||
|
||||
const CGFloat g_UMComEditForwardView_forwardCreatorHeight = 25;//@feed作者的高度(此处用UI提供的15会显示不全,需要上下都加5个距离)
|
||||
|
||||
const CGFloat g_UMComEditForwardView_spaceBetweenCreatorAndContent = 5;//@feed作者和内容的边距
|
||||
|
||||
const CGFloat g_UMComEditForwardView_forwardContentHeight = 40;//@feed内容的高度(self.forwardEditTextView.scrollEnabled = YES,32的高度刚好显示两行||self.forwardEditTextView.scrollEnabled = NO,40的高度刚好显示两行)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@interface UMComEditForwardView ()
|
||||
|
||||
|
||||
|
||||
@property (nonatomic, strong) UMComEditTextView *forwardCreatorEditTextView;
|
||||
@end
|
||||
|
||||
@implementation UMComEditForwardView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)reloadViewsWithText:(NSString *)text checkWords:(NSArray *)checkWords urlString:(NSString *)urlString
|
||||
{
|
||||
[self.forwardImageView removeFromSuperview];
|
||||
[self.forwardEditTextView removeFromSuperview];
|
||||
//self.forwardEditTextView.placeholderLabel.text = @" 说说你的观点...";
|
||||
self.forwardEditTextView.placeholderLabel.text = UMComLocalizedString(@"um_com_editView_placeholder", @" 说说你的观点...");
|
||||
NSArray *regexArray = [NSArray arrayWithObjects:UserRulerString, TopicRulerString,UrlRelerSring, nil];
|
||||
if (urlString) {
|
||||
/*
|
||||
self.forwardImageView = [[[UMComImageView imageViewClassName] alloc] initWithFrame:CGRectMake(self.frame.size.width-75, self.frame.size.height/2-35+3, 70, 70)];
|
||||
self.forwardImageView.isAutoStart = YES;
|
||||
self.forwardImageView.backgroundColor = [UIColor clearColor];
|
||||
[self.forwardImageView setImageURL:urlString placeHolderImage:UMComImageWithImageName(@"photox")];
|
||||
self.forwardEditTextView = [[UMComEditTextView alloc]initWithFrame:CGRectMake(5, 5, self.frame.size.width-self.forwardImageView.frame.size.width-5, self.frame.size.height-5) checkWords:checkWords regularExStrArray:regexArray];
|
||||
[self addSubview:self.forwardImageView];
|
||||
*/
|
||||
self.forwardImageView = [[[UMComImageView imageViewClassName] alloc] initWithFrame:CGRectMake(5, self.frame.size.height/2-35+3, 70, 70)];
|
||||
self.forwardImageView.isAutoStart = YES;
|
||||
self.forwardImageView.backgroundColor = [UIColor clearColor];
|
||||
[self.forwardImageView setImageURL:urlString placeHolderImage:UMComImageWithImageName(@"photox")];
|
||||
|
||||
self.forwardEditTextView = [[UMComEditTextView alloc]initWithFrame:CGRectMake(5 + self.forwardImageView.frame.size.width, 5, self.frame.size.width-self.forwardImageView.frame.size.width-5, self.frame.size.height-5) checkWords:checkWords regularExStrArray:regexArray];
|
||||
[self addSubview:self.forwardImageView];
|
||||
|
||||
}else{
|
||||
self.forwardEditTextView = [[UMComEditTextView alloc]initWithFrame:CGRectMake(5, 5, self.frame.size.width-10, self.frame.size.height-5) checkWords:checkWords regularExStrArray:regexArray];
|
||||
}
|
||||
UIImage *resizableImage = [UMComImageWithImageName(@"origin_image_bg") resizableImageWithCapInsets:UIEdgeInsetsMake(20, 50, 0, 0)];
|
||||
self.image = resizableImage;
|
||||
self.forwardEditTextView.backgroundColor = [UIColor clearColor];
|
||||
[self addSubview:self.forwardEditTextView];
|
||||
self.userInteractionEnabled = YES;
|
||||
self.forwardEditTextView.checkWords = checkWords;
|
||||
[self.forwardEditTextView setFont:UMComFontNotoSansLightWithSafeSize(15)];
|
||||
self.forwardEditTextView.text = text;
|
||||
self.forwardEditTextView.editable = NO;
|
||||
[self.forwardEditTextView updateEditTextView];
|
||||
}
|
||||
|
||||
- (void)reloadViewsWithForwardCreator:(NSString *)forwardCreator forwardContent:(NSString*)forwardContent checkWords:(NSArray *)checkWords urlString:(NSString *)urlString
|
||||
{
|
||||
self.backgroundColor = UMComColorWithHexString(@"#F5F6FA");
|
||||
|
||||
[self.forwardImageView removeFromSuperview];
|
||||
[self.forwardCreatorEditTextView removeFromSuperview];
|
||||
[self.forwardEditTextView removeFromSuperview];
|
||||
self.forwardEditTextView.placeholderLabel.text = UMComLocalizedString(@"um_com_editView_placeholder", @" 说说你的观点...");
|
||||
NSArray *regexArray = [NSArray arrayWithObjects:UserRulerString, TopicRulerString,UrlRelerSring, nil];
|
||||
if (urlString) {
|
||||
self.forwardImageView = [[[UMComImageView imageViewClassName] alloc] initWithFrame:CGRectMake(g_UMComEditForwardView_LeftMargin,g_UMComEditForwardView_forwardImageTopMargin,g_UMComEditForwardView_forwardImageWidth,g_UMComEditForwardView_forwardImageHeight)];
|
||||
|
||||
self.forwardImageView.isAutoStart = YES;
|
||||
self.forwardImageView.backgroundColor = [UIColor clearColor];
|
||||
[self.forwardImageView setImageURL:urlString placeHolderImage:UMComImageWithImageName(@"photox")];
|
||||
[self addSubview:self.forwardImageView];
|
||||
}
|
||||
else{
|
||||
if (self.forwardImageView) {
|
||||
self.forwardImageView.frame = CGRectMake(0, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//创建feed的创建者的textview
|
||||
self.forwardCreatorEditTextView = [[UMComEditTextView alloc]initWithFrame:CGRectMake(g_UMComEditForwardView_LeftMargin + self.forwardImageView.bounds.size.width + g_UMComEditForwardView_spaceBetweenImgAndText,
|
||||
g_UMComEditForwardView_forwardCreatorTopMargin,
|
||||
self.bounds.size.width - g_UMComEditForwardView_LeftMargin - g_UMComEditForwardView_RightMargin - g_UMComEditForwardView_spaceBetweenImgAndText - self.forwardImageView.bounds.size.width,
|
||||
g_UMComEditForwardView_forwardCreatorHeight)
|
||||
checkWords:checkWords
|
||||
regularExStrArray:regexArray];
|
||||
|
||||
self.forwardCreatorEditTextView.scrollEnabled = NO;//不允许滑动
|
||||
self.forwardCreatorEditTextView.backgroundColor = [UIColor clearColor];
|
||||
self.userInteractionEnabled = YES;
|
||||
self.forwardCreatorEditTextView.checkWords = checkWords;
|
||||
[self.forwardCreatorEditTextView setFont:UMComFontNotoSansLightWithSafeSize(14)];
|
||||
self.forwardCreatorEditTextView.text = forwardCreator;
|
||||
self.forwardCreatorEditTextView.editable = NO;
|
||||
[self.forwardCreatorEditTextView updateEditTextView];
|
||||
[self addSubview:self.forwardCreatorEditTextView];
|
||||
self.forwardCreatorEditTextView.textColor = UMComColorWithHexString(@"#666666");
|
||||
|
||||
CGSize minforwardCreatorSize = [forwardCreator sizeWithFont:UMComFontNotoSansLightWithSafeSize(14)];
|
||||
if (self.forwardCreatorEditTextView.bounds.size.height < minforwardCreatorSize.height) {
|
||||
CGRect tempforwardCreatorBound = self.forwardCreatorEditTextView.bounds;
|
||||
tempforwardCreatorBound.size.height = minforwardCreatorSize.height + 5;
|
||||
self.forwardCreatorEditTextView.bounds = tempforwardCreatorBound;
|
||||
|
||||
}
|
||||
|
||||
//创建feed的创建者的内容的texview
|
||||
self.forwardEditTextView = [[UMComEditTextView alloc]initWithFrame:CGRectMake(g_UMComEditForwardView_LeftMargin + self.forwardImageView.bounds.size.width + g_UMComEditForwardView_spaceBetweenImgAndText,
|
||||
g_UMComEditForwardView_forwardCreatorTopMargin + self.forwardCreatorEditTextView.bounds.size.height + g_UMComEditForwardView_spaceBetweenCreatorAndContent,
|
||||
self.bounds.size.width - g_UMComEditForwardView_LeftMargin - g_UMComEditForwardView_RightMargin - g_UMComEditForwardView_spaceBetweenImgAndText - self.forwardImageView.bounds.size.width,
|
||||
g_UMComEditForwardView_forwardContentHeight)
|
||||
checkWords:checkWords
|
||||
regularExStrArray:regexArray];
|
||||
|
||||
self.forwardEditTextView.backgroundColor = [UIColor clearColor];
|
||||
self.userInteractionEnabled = YES;
|
||||
self.forwardEditTextView.checkWords = checkWords;
|
||||
[self.forwardEditTextView setFont:UMComFontNotoSansLightWithSafeSize(12)];
|
||||
self.forwardEditTextView.text = forwardContent;
|
||||
self.forwardEditTextView.editable = NO;
|
||||
[self.forwardEditTextView updateEditTextView];
|
||||
[self addSubview:self.forwardEditTextView];
|
||||
self.forwardEditTextView.textColor = UMComColorWithHexString(@"#A5A5A5");
|
||||
self.forwardEditTextView.scrollEnabled = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// UMComViewController.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 15/8/7.
|
||||
// Copyright (c) 2015年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import "UMComRequestTableViewController.h"
|
||||
|
||||
@class UMComLocation;
|
||||
|
||||
@interface UMComLocationListController : UMComRequestTableViewController
|
||||
|
||||
-(id)initWithLocationSelectedComplectionBlock:(void (^)(UMComLocation *locationModel))block;
|
||||
|
||||
@end
|
||||
+151
@@ -0,0 +1,151 @@
|
||||
//
|
||||
// UMComLocationTableViewController1.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 15/8/7.
|
||||
// Copyright (c) 2015年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComLocationListController.h"
|
||||
#import <CoreLocation/CoreLocation.h>
|
||||
#import "UMComLocationTableViewCell.h"
|
||||
#import "UMComShowToast.h"
|
||||
#import <UMComFoundation/UMUtils.h>
|
||||
#import "UIViewController+UMComAddition.h"
|
||||
#import <UMComDataStorage/UMComLocation.h>
|
||||
#import "UMComLocationListDataController.h"
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
|
||||
@interface UMComLocationListController ()<CLLocationManagerDelegate>
|
||||
|
||||
@property (nonatomic, strong) CLLocationManager *locationManager;
|
||||
@property (nonatomic, strong) CLLocation *location;
|
||||
|
||||
@property (nonatomic, copy) void (^complectionBlock)(UMComLocation *locationModel);
|
||||
|
||||
@property(nonatomic,strong)UMComLocationListDataController* locationListDataController;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComLocationListController
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
if ([self respondsToSelector:@selector(setEdgesForExtendedLayout:)]) {
|
||||
self.edgesForExtendedLayout = UIRectEdgeNone;
|
||||
}
|
||||
if ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusRestricted
|
||||
|| [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {
|
||||
[[[UIAlertView alloc] initWithTitle:nil message:UMComLocalizedString(@"um_com_location_authority_prompt",@"此应用程序没有权限访问地理位置信息,请在隐私设置里启用") delegate:nil cancelButtonTitle:UMComLocalizedString(@"um_com_ok", @"好的") otherButtonTitles:nil, nil] show];
|
||||
}
|
||||
if (NO==[CLLocationManager locationServicesEnabled]) {
|
||||
UMLog(@"---------- 未开启定位");
|
||||
}
|
||||
[self setTitleViewWithTitle:UMComLocalizedString(@"um_com_myLocationTitle",@"我的位置")];
|
||||
self.locationManager = [[CLLocationManager alloc] init];
|
||||
self.locationManager.delegate = self;
|
||||
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;
|
||||
self.locationManager.distanceFilter = 15.0f;
|
||||
|
||||
[_locationManager startUpdatingLocation];
|
||||
|
||||
[self.tableView registerNib:[UINib nibWithNibName:@"UMComLocationTableViewCell" bundle:nil] forCellReuseIdentifier:@"LocationTableViewCell"];
|
||||
|
||||
if (!([CLLocationManager locationServicesEnabled] == YES && [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)){
|
||||
|
||||
if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0f) {
|
||||
[self.locationManager requestAlwaysAuthorization];
|
||||
}
|
||||
}
|
||||
self.tableView.rowHeight = LocationCellHeight;
|
||||
|
||||
self.locationListDataController = [[UMComLocationListDataController alloc] initWithCount:UMCom_Limit_Page_Count withLocation:nil];
|
||||
self.isAutoStartLoadData = NO;//该界面需要获得定位后,才触发请求
|
||||
}
|
||||
|
||||
- (id)initWithLocationSelectedComplectionBlock:(void (^)(UMComLocation *locationModel))block
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
self.complectionBlock = block;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
|
||||
}
|
||||
|
||||
#pragma mark - Table view data source
|
||||
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
if (self.dataController.dataArray.count == 0) {
|
||||
return 0;
|
||||
}
|
||||
return self.dataController.dataArray.count + 1;
|
||||
}
|
||||
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
static NSString *cellIdentifier = @"LocationTableViewCell";
|
||||
UMComLocationTableViewCell *cell = (UMComLocationTableViewCell *)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
|
||||
cell.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
if (indexPath.row == 0) {
|
||||
cell.locationName.center = CGPointMake(cell.locationName.center.x, tableView.rowHeight/2);
|
||||
cell.locationName.text = UMComLocalizedString(@"um_com_hideLocation", @"不显示位置");
|
||||
cell.locationDetail.hidden = YES;
|
||||
cell.locationName.textColor = UMComColorWithHexString(FontColorBlue);
|
||||
}else{
|
||||
UMComLocation *locationModel = self.dataController.dataArray[indexPath.row-1];
|
||||
cell.locationName.textColor = [UIColor blackColor];
|
||||
cell.locationName.center = CGPointMake(cell.locationName.center.x, (tableView.rowHeight-cell.locationDetail.frame.size.height)/2);
|
||||
cell.locationDetail.hidden = NO;
|
||||
[cell reloadFromLocationModel:locationModel];
|
||||
}
|
||||
return cell;
|
||||
}
|
||||
|
||||
#pragma mark - locationManagerDelegate
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager
|
||||
didUpdateLocations:(NSArray *)locations
|
||||
{
|
||||
// self.fetchRequest = [[UMComLocationRequest alloc]initWithLocation:manager.location];
|
||||
// [self refreshNewDataFromServer:nil];
|
||||
|
||||
self.locationListDataController.location = manager.location;
|
||||
self.dataController = self.locationListDataController;
|
||||
[self refreshData];
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)locationManager:(CLLocationManager *)manager
|
||||
didFailWithError:(NSError *)error
|
||||
{
|
||||
[UMComShowToast fetchFailWithNoticeMessage:UMComLocalizedString(@"um_com_failToLocation",@"定位失败")];
|
||||
}
|
||||
|
||||
#pragma mark - Table view delegate
|
||||
|
||||
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
|
||||
if (indexPath.row > 0) {
|
||||
UMComLocation *locationModel = self.dataController.dataArray[indexPath.row-1];
|
||||
// self.editViewModel.locationDescription = locationModel.name;
|
||||
if (self.complectionBlock) {
|
||||
self.complectionBlock(locationModel);
|
||||
}
|
||||
}else{
|
||||
// self.editViewModel.locationDescription = @"";
|
||||
if (self.complectionBlock) {
|
||||
self.complectionBlock(nil);
|
||||
}
|
||||
}
|
||||
[self.navigationController popViewControllerAnimated:YES];
|
||||
}
|
||||
|
||||
@end
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// UMComLocationTableViewCell.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by Gavin Ye on 12/18/14.
|
||||
// Copyright (c) 2014 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#define LocationCellHeight 60;
|
||||
|
||||
@class UMComLocation;
|
||||
|
||||
@interface UMComLocationTableViewCell : UITableViewCell
|
||||
|
||||
@property (nonatomic, weak) IBOutlet UILabel *locationName;
|
||||
|
||||
@property (nonatomic, weak) IBOutlet UILabel *locationDetail;
|
||||
|
||||
|
||||
- (void)reloadFromLocationModel:(UMComLocation *)locationModel;
|
||||
|
||||
@end
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// UMComLocationTableViewCell.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by Gavin Ye on 12/18/14.
|
||||
// Copyright (c) 2014 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComLocationTableViewCell.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import <UMComDataStorage/UMComLocation.h>
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
@implementation UMComLocationTableViewCell
|
||||
|
||||
- (void)awakeFromNib {
|
||||
self.locationName.font = UMComFontNotoSansLightWithSafeSize(17);
|
||||
self.locationDetail.font = UMComFontNotoSansLightWithSafeSize(15);
|
||||
}
|
||||
|
||||
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
|
||||
[super setSelected:selected animated:animated];
|
||||
|
||||
// Configure the view for the selected state
|
||||
}
|
||||
//
|
||||
// 自绘分割线
|
||||
- (void)drawRect:(CGRect)rect
|
||||
{
|
||||
CGContextRef context = UIGraphicsGetCurrentContext();
|
||||
|
||||
CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor);
|
||||
CGContextFillRect(context, rect);
|
||||
|
||||
CGContextSetStrokeColorWithColor(context, UMComTableViewSeparatorColor.CGColor);
|
||||
CGContextStrokeRect(context, CGRectMake(0, rect.size.height - TableViewCellSpace, rect.size.width, TableViewCellSpace));
|
||||
|
||||
}
|
||||
|
||||
- (void)reloadFromLocationModel:(UMComLocation *)locationModel
|
||||
{
|
||||
[self.locationName setText:locationModel.name];
|
||||
[self.locationDetail setText:locationModel.address];
|
||||
}
|
||||
|
||||
@end
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
|
||||
</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="61" id="KGk-i7-Jjw" customClass="UMComLocationTableViewCell">
|
||||
<rect key="frame" x="0.0" y="0.0" width="320" height="60"/>
|
||||
<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="59"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="ICM-Lr-urc">
|
||||
<rect key="frame" x="20" y="10" width="280" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="FOe-t5-k4i">
|
||||
<rect key="frame" x="20" y="34" width="280" height="21"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="15"/>
|
||||
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</tableViewCellContentView>
|
||||
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
|
||||
<connections>
|
||||
<outlet property="locationDetail" destination="FOe-t5-k4i" id="FfY-5j-Jig"/>
|
||||
<outlet property="locationName" destination="ICM-Lr-urc" id="ACX-LX-3ND"/>
|
||||
</connections>
|
||||
<point key="canvasLocation" x="214" y="245.5"/>
|
||||
</tableViewCell>
|
||||
</objects>
|
||||
<simulatedMetricsContainer key="defaultSimulatedMetrics">
|
||||
<simulatedStatusBarMetrics key="statusBar"/>
|
||||
<simulatedOrientationMetrics key="orientation"/>
|
||||
<simulatedScreenMetrics key="destination" type="retina4"/>
|
||||
</simulatedMetricsContainer>
|
||||
</document>
|
||||
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// UMComLocationView.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 15/11/20.
|
||||
// Copyright © 2015年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
typedef void (^SelectedLocationViewBlock)();
|
||||
@interface UMComLocationView : UIView
|
||||
|
||||
@property (nonatomic, strong) UIImageView *imageView;
|
||||
|
||||
@property (nonatomic, strong) UILabel *label;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *indicatorView;
|
||||
|
||||
@property(nonatomic,strong) UIColor* locationbackgroudColor;//背景色
|
||||
|
||||
|
||||
@property(nonatomic,readwrite,copy)SelectedLocationViewBlock locationBlock;
|
||||
|
||||
/**
|
||||
* 重新布局子控件,
|
||||
* 1.如果location为空或者空字符串就显示提示控件
|
||||
* 2.反之就隐藏提示控件,显示位置控件
|
||||
*/
|
||||
-(void) relayoutChildControlsWithLocation:(NSString*)location;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,223 @@
|
||||
//
|
||||
// UMComLocationView.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by umeng on 15/11/20.
|
||||
// Copyright © 2015年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComLocationView.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
//以下为iphone6的内部模板
|
||||
const static int g_UMComLocationView_leadmarginTemplate = 15;//左边空白区域
|
||||
const static int g_UMComLocationView_tailmarginTemplate = 13;//右边空白区域
|
||||
const static int g_UMComLocationView_ImageTopmargin = 13;//图片上边距
|
||||
const static int g_UMComLocationView_ImageWidth = 16;//图片宽
|
||||
const static int g_UMComLocationView_ImageHeight = 20;//图片高
|
||||
|
||||
const static int g_UMComLocationView_IndicatorViewWidth = 11;//指示器的宽
|
||||
const static int g_UMComLocationView_IndicatorViewHeight = 20;//指示器的高
|
||||
|
||||
const static int g_UMComLocationView_marginBetweenImageAndLabel = 6;//图片和文字区域的空白
|
||||
const static int g_UMComLocationView_topAndbottommarginTemplate = 20;//上下加起来的空白区域针对imageView
|
||||
const static int g_UMComLocationView_topAndbottommarginTemplateForIndicator = 26;//上下加起来的空白区域针对indicatorView
|
||||
const static int g_UMComLocationView_widthTemplate = 375;//在iphone6的宽度
|
||||
|
||||
|
||||
|
||||
|
||||
@interface UMComLocationView()
|
||||
|
||||
@property (nonatomic, assign) CGFloat height;
|
||||
|
||||
@property (nonatomic,readwrite,strong) UILabel* placeholder;
|
||||
@property (nonatomic,readwrite,strong)UITapGestureRecognizer* tap;
|
||||
-(void)handleTapGesture:(UIGestureRecognizer*)gestureRecognizer;
|
||||
@end
|
||||
|
||||
@implementation UMComLocationView
|
||||
|
||||
/*
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
self = [super initWithFrame:frame];
|
||||
if (self) {
|
||||
CGFloat originX = 6;
|
||||
CGFloat originY = 4;
|
||||
self.imageView = [[UIImageView alloc]initWithFrame:CGRectMake(originX, originX, frame.size.height-originX*2, frame.size.height-originY*2)];
|
||||
self.imageView.backgroundColor = [UIColor clearColor];
|
||||
self.imageView.image = UMComImageWithImageName(@"pin3x@2x");
|
||||
[self addSubview:self.imageView];
|
||||
|
||||
self.label = [[UILabel alloc]initWithFrame:CGRectMake(frame.size.height, 0, frame.size.width-frame.size.height, frame.size.height)];
|
||||
self.label.backgroundColor = [UIColor clearColor];
|
||||
self.label.font = UMComFontNotoSansLightWithSafeSize(13);
|
||||
[self addSubview:self.label];
|
||||
self.height = frame.size.height;
|
||||
|
||||
self.placeholder = [[UILabel alloc] initWithFrame:CGRectMake(originX, 0, self.bounds.size.width, self.bounds.size.height)];
|
||||
self.placeholder.font = UMComFontNotoSansLightWithSafeSize(13);
|
||||
self.placeholder.text = @"地址位置";
|
||||
self.placeholder.textAlignment = NSTextAlignmentLeft;
|
||||
self.placeholder.hidden = YES;
|
||||
[self addSubview:self.placeholder];
|
||||
|
||||
self.tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
|
||||
[self addGestureRecognizer:self.tap];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
*/
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
|
||||
self.imageView = [[UIImageView alloc] initWithImage:UMComImageWithImageName(@"um_forum_location")];
|
||||
self.imageView.backgroundColor = [UIColor clearColor];
|
||||
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:self.imageView];
|
||||
|
||||
self.label = [[UILabel alloc] init];
|
||||
self.label.backgroundColor = [UIColor clearColor];
|
||||
self.label.font = UMComFontNotoSansLightWithSafeSize(15);
|
||||
self.label.textColor = UMComColorWithHexString(@"#A5A5A5");
|
||||
[self addSubview:self.label];
|
||||
|
||||
|
||||
self.indicatorView = [[UIImageView alloc] initWithImage:UMComImageWithImageName(@"um_forum_arrow_gray")];
|
||||
self.indicatorView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:self.indicatorView];
|
||||
|
||||
self.tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
|
||||
[self addGestureRecognizer:self.tap];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
/*
|
||||
-(void) doRelayoutChildControlsWithFrame:(CGRect)frame
|
||||
{
|
||||
CGFloat parentHeight = frame.size.height;
|
||||
CGFloat parentWidth = frame.size.width;
|
||||
//计算imageView的位置
|
||||
//此处无需在计算宽度,宽度一定比高度大
|
||||
int imageView_topAndbottommarginTemplate = g_UMComLocationView_topAndbottommarginTemplate*parentWidth/g_UMComLocationView_widthTemplate;
|
||||
//int imageViewHeight = parentHeight - g_UMComLocationView_topAndbottommarginTemplate;
|
||||
//self.imageView.frame = CGRectMake(g_UMComLocationView_leadmarginTemplate, g_UMComLocationView_topAndbottommarginTemplate/2, imageViewHeight, imageViewHeight);
|
||||
int imageViewHeight = parentHeight - imageView_topAndbottommarginTemplate;
|
||||
self.imageView.frame = CGRectMake(g_UMComLocationView_leadmarginTemplate, imageView_topAndbottommarginTemplate/2, imageViewHeight, imageViewHeight);
|
||||
|
||||
|
||||
|
||||
//计算indicatorView的位置
|
||||
int indicatorView_topAndbottommarginTemplateForIndicator = g_UMComLocationView_topAndbottommarginTemplateForIndicator*parentWidth/g_UMComLocationView_widthTemplate;
|
||||
int indicatorViewHeight = parentHeight - indicatorView_topAndbottommarginTemplateForIndicator;
|
||||
// self.indicatorView.frame = CGRectMake(parentWidth - imageViewHeight - g_UMComLocationView_tailmarginTemplate, (g_UMComLocationView_topAndbottommarginTemplateForIndicator)/2, indicatorViewHeight, indicatorViewHeight);
|
||||
self.indicatorView.frame = CGRectMake(parentWidth - imageViewHeight - indicatorView_topAndbottommarginTemplateForIndicator, (indicatorView_topAndbottommarginTemplateForIndicator)/2, indicatorViewHeight, indicatorViewHeight);
|
||||
|
||||
//计算label的位置
|
||||
self.label.frame = CGRectMake(self.imageView.frame.origin.x + self.imageView.frame.size.width + g_UMComLocationView_marginBetweenImageAndLabel,0, self.indicatorView.frame.origin.x - g_UMComLocationView_marginBetweenImageAndLabel - self.imageView.frame.origin.x - self.imageView.frame.size.width,parentHeight);
|
||||
|
||||
}
|
||||
*/
|
||||
-(void) doRelayoutChildControlsWithFrame:(CGRect)frame
|
||||
{
|
||||
CGFloat parentHeight = frame.size.height;
|
||||
CGFloat parentWidth = frame.size.width;
|
||||
self.imageView.frame = CGRectMake(g_UMComLocationView_leadmarginTemplate, g_UMComLocationView_ImageTopmargin, g_UMComLocationView_ImageWidth, g_UMComLocationView_ImageHeight);
|
||||
|
||||
|
||||
self.indicatorView.frame = CGRectMake(parentWidth - g_UMComLocationView_tailmarginTemplate - g_UMComLocationView_IndicatorViewWidth, g_UMComLocationView_ImageTopmargin, g_UMComLocationView_IndicatorViewWidth, g_UMComLocationView_IndicatorViewHeight);
|
||||
|
||||
//计算label的位置
|
||||
self.label.frame = CGRectMake(self.imageView.frame.origin.x + self.imageView.frame.size.width + g_UMComLocationView_marginBetweenImageAndLabel,0, self.indicatorView.frame.origin.x - g_UMComLocationView_marginBetweenImageAndLabel - self.imageView.frame.origin.x - self.imageView.frame.size.width,parentHeight);
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self removeGestureRecognizer:self.tap];
|
||||
|
||||
self.imageView = nil;
|
||||
self.label = nil;
|
||||
self.indicatorView = nil;
|
||||
self.placeholder = nil;
|
||||
}
|
||||
|
||||
-(void) hidePlaceholder:(BOOL)isHide
|
||||
{
|
||||
self.placeholder.hidden = isHide;
|
||||
self.label.hidden = !isHide;
|
||||
self.imageView.hidden = !isHide;
|
||||
}
|
||||
|
||||
-(void) relayoutChildControlsWithLocation:(NSString*)location
|
||||
{
|
||||
if (!location) {
|
||||
//如果没有值就显示placeholder,隐藏其他控件
|
||||
//[self hidePlaceholder:NO];
|
||||
self.label.text = UMComLocalizedString(@"um_com_locationview_prompt", @"地理位置");
|
||||
self.label.textColor = UMComColorWithHexString(@"#b5b5b5");
|
||||
}
|
||||
else if([location isEqualToString:@""])
|
||||
{
|
||||
//如果是空字符串,也隐藏其他控件
|
||||
self.label.text = location;
|
||||
self.label.textColor = UMComColorWithHexString(@"#b5b5b5");
|
||||
//[self hidePlaceholder:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
//如果有值就隐藏placeholder,显示其他控件
|
||||
self.label.text = location;
|
||||
self.label.textColor = UMComColorWithHexString(@"#008bea");
|
||||
//[self hidePlaceholder:YES];
|
||||
}
|
||||
|
||||
[self doRelayoutChildControlsWithFrame:self.bounds];
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches
|
||||
withEvent:(UIEvent *)event
|
||||
{
|
||||
if (YES) {
|
||||
self.backgroundColor = [UIColor lightGrayColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event
|
||||
{
|
||||
if (YES) {
|
||||
if (self.locationbackgroudColor) {
|
||||
self.backgroundColor = self.locationbackgroudColor;
|
||||
}
|
||||
else{
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event
|
||||
{
|
||||
if (YES) {
|
||||
if (self.locationbackgroudColor) {
|
||||
self.backgroundColor = self.locationbackgroudColor;
|
||||
}
|
||||
else{
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
}}
|
||||
|
||||
-(void)handleTapGesture:(UIGestureRecognizer*)gestureRecognizer
|
||||
{
|
||||
if (self.locationBlock) {
|
||||
self.locationBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// UMComSelectTopicView.h
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by 张军华 on 16/3/24.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
typedef void (^SelectedTopicViewBlock)();
|
||||
|
||||
/**
|
||||
* 编辑界面显示选择话题控件
|
||||
*/
|
||||
@interface UMComSelectTopicView : UIView
|
||||
|
||||
@property (nonatomic, strong) UIImageView *imageView;
|
||||
|
||||
@property (nonatomic, strong) UILabel *label;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *indicatorView;
|
||||
|
||||
@property(nonatomic,strong) UIColor* locationbackgroudColor;//背景色
|
||||
|
||||
@property(nonatomic,readwrite,copy)SelectedTopicViewBlock seletctedTopicBlock;
|
||||
|
||||
@property(nonatomic,readwrite,assign)BOOL isDimed;//YES 不会有点击效果 NO 有点击效果
|
||||
/**
|
||||
* 重新布局子控件,
|
||||
* 1.如果topicName为空或者空字符串就显示提示控件
|
||||
* 2.反之就隐藏提示控件,显示位置控件
|
||||
*/
|
||||
-(void) relayoutChildControlsWithTopicName:(NSString*)topicName;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,175 @@
|
||||
//
|
||||
// UMComSelectTopicView.m
|
||||
// UMCommunity
|
||||
//
|
||||
// Created by 张军华 on 16/3/24.
|
||||
// Copyright © 2016年 Umeng. All rights reserved.
|
||||
//
|
||||
|
||||
#import "UMComSelectTopicView.h"
|
||||
#import "UMComResouceDefines.h"
|
||||
#import <UMComFoundation/UMComKit+Color.h>
|
||||
|
||||
//以下为iphone6的内部模板
|
||||
const static int g_UMComSelectTopicView_leadmarginTemplate = 15;//左边空白区域
|
||||
const static int g_UMComSelectTopicView_tailmarginTemplate = 13;//右边空白区域
|
||||
const static int g_UMComSelectTopicView_ImageTopmargin = 13;//图片上边距
|
||||
const static int g_UMComSelectTopicView_ImageWidth = 16;//图片宽
|
||||
const static int g_UMComSelectTopicView_ImageHeight = 20;//图片高
|
||||
|
||||
const static int g_UMComSelectTopicView_IndicatorViewWidth = 20;//指示器的宽
|
||||
const static int g_UMComSelectTopicView_IndicatorViewHeight = 20;//指示器的高
|
||||
|
||||
const static int g_UMComSelectTopicView_marginBetweenImageAndLabel = 6;//图片和文字区域的空白
|
||||
|
||||
@interface UMComSelectTopicView ()
|
||||
@property (nonatomic, assign) CGFloat height;
|
||||
|
||||
@property (nonatomic,readwrite,strong) UILabel* placeholder;
|
||||
@property (nonatomic,readwrite,strong)UITapGestureRecognizer* tap;
|
||||
-(void)handleTapGesture:(UIGestureRecognizer*)gestureRecognizer;
|
||||
|
||||
@end
|
||||
|
||||
@implementation UMComSelectTopicView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame
|
||||
{
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
|
||||
self.imageView = [[UIImageView alloc] initWithImage:UMComImageWithImageName(@"um_edit_#_normal")];
|
||||
self.imageView.backgroundColor = [UIColor clearColor];
|
||||
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:self.imageView];
|
||||
|
||||
self.label = [[UILabel alloc] init];
|
||||
self.label.backgroundColor = [UIColor clearColor];
|
||||
self.label.font = UMComFontNotoSansLightWithSafeSize(15);
|
||||
self.label.textColor = UMComColorWithHexString(@"#A5A5A5");
|
||||
[self addSubview:self.label];
|
||||
|
||||
|
||||
self.indicatorView = [[UIImageView alloc] initWithImage:UMComImageWithImageName(@"um_edit_!_heilight")];
|
||||
self.indicatorView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[self addSubview:self.indicatorView];
|
||||
|
||||
self.tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapGesture:)];
|
||||
[self addGestureRecognizer:self.tap];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self removeGestureRecognizer:self.tap];
|
||||
|
||||
self.imageView = nil;
|
||||
self.label = nil;
|
||||
self.indicatorView = nil;
|
||||
self.placeholder = nil;
|
||||
}
|
||||
|
||||
-(void) doRelayoutChildControlsWithFrame:(CGRect)frame
|
||||
{
|
||||
CGFloat parentHeight = frame.size.height;
|
||||
CGFloat parentWidth = frame.size.width;
|
||||
self.imageView.frame = CGRectMake(g_UMComSelectTopicView_leadmarginTemplate, g_UMComSelectTopicView_ImageTopmargin, g_UMComSelectTopicView_ImageWidth, g_UMComSelectTopicView_ImageHeight);
|
||||
|
||||
|
||||
self.indicatorView.frame = CGRectMake(parentWidth - g_UMComSelectTopicView_tailmarginTemplate - g_UMComSelectTopicView_IndicatorViewWidth, g_UMComSelectTopicView_ImageTopmargin, g_UMComSelectTopicView_IndicatorViewWidth, g_UMComSelectTopicView_IndicatorViewHeight);
|
||||
|
||||
//计算label的位置
|
||||
self.label.frame = CGRectMake(self.imageView.frame.origin.x + self.imageView.frame.size.width + g_UMComSelectTopicView_marginBetweenImageAndLabel,0, self.indicatorView.frame.origin.x - g_UMComSelectTopicView_marginBetweenImageAndLabel - self.imageView.frame.origin.x - self.imageView.frame.size.width,parentHeight);
|
||||
}
|
||||
|
||||
-(void) hidePlaceholder:(BOOL)isHide
|
||||
{
|
||||
self.placeholder.hidden = isHide;
|
||||
self.label.hidden = !isHide;
|
||||
self.imageView.hidden = !isHide;
|
||||
}
|
||||
|
||||
-(void) relayoutChildControlsWithTopicName:(NSString*)topicName;
|
||||
{
|
||||
if (!topicName) {
|
||||
//如果没有值就显示placeholder,隐藏其他控件
|
||||
//[self hidePlaceholder:NO];
|
||||
self.indicatorView.hidden = NO;
|
||||
self.imageView.image = UMComImageWithImageName(@"um_edit_#_normal");
|
||||
self.label.text = UMComLocalizedString(@"um_com_selectTopicView_prompt", @"所属话题");
|
||||
self.label.textColor = UMComColorWithHexString(@"#b5b5b5");
|
||||
}
|
||||
else if([topicName isEqualToString:@""])
|
||||
{
|
||||
//如果是空字符串,也隐藏其他控件
|
||||
self.indicatorView.hidden = YES;
|
||||
self.label.text = topicName;
|
||||
self.label.textColor = UMComColorWithHexString(@"#b5b5b5");
|
||||
//[self hidePlaceholder:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
self.indicatorView.hidden = YES;
|
||||
self.imageView.image = UMComImageWithImageName(@"um_edit_#_highlight");
|
||||
//如果有值就隐藏placeholder,显示其他控件
|
||||
self.label.text = topicName;
|
||||
self.label.textColor = UMComColorWithHexString(@"#008bea");
|
||||
//[self hidePlaceholder:YES];
|
||||
}
|
||||
|
||||
[self doRelayoutChildControlsWithFrame:self.bounds];
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches
|
||||
withEvent:(UIEvent *)event
|
||||
{
|
||||
if (self.isDimed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (YES) {
|
||||
self.backgroundColor = [UIColor lightGrayColor];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event
|
||||
{
|
||||
if (self.isDimed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (YES) {
|
||||
if (self.locationbackgroudColor) {
|
||||
self.backgroundColor = self.locationbackgroudColor;
|
||||
}
|
||||
else{
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event
|
||||
{
|
||||
if (self.isDimed) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (YES) {
|
||||
if (self.locationbackgroudColor) {
|
||||
self.backgroundColor = self.locationbackgroudColor;
|
||||
}
|
||||
else{
|
||||
self.backgroundColor = [UIColor whiteColor];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-(void)handleTapGesture:(UIGestureRecognizer*)gestureRecognizer
|
||||
{
|
||||
if (self.seletctedTopicBlock) {
|
||||
self.seletctedTopicBlock();
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user