<殊途公寓>項目總結

2017.06.01-2017.07.15

擴大UIButton的點擊范圍

CGFloat const touchSize = 44; //蘋果官方默認44,小于44則為弱反應
CGFloat const sizeMax   = - .5;

@implementation YFWLButton //繼承UIButton的一個自定義類
///擴大點擊范圍
- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event{
    CGRect bounds   = self.bounds;
    CGFloat width   = MAX(touchSize - bounds.size.width, 0);
    CGFloat height  = MAX(touchSize - bounds.size.height, 0);
    bounds = CGRectInset(bounds, sizeMax * width, sizeMax * height);
    return CGRectContainsPoint(bounds, point);
}

操作NSDate的自定義類方法

自定義類方法的.h文件

#import <Foundation/Foundation.h>

@interface YFWLDateManager : NSObject

/**獲取day*/
+ (NSInteger)day:(NSDate *)date;
/**獲取Month*/
+ (NSInteger)month:(NSDate *)date;
/**獲取year*/
+ (NSInteger)year:(NSDate *)date;
/**獲取第一天是在第幾天*/
+ (NSInteger)firstWeekdayInThisMonth:(NSDate *)date;
/**獲取月數總天數*/
+ (NSInteger)totaldaysInThisMonth:(NSDate *)date;
/**獲取月份總天數*/
+ (NSInteger)totaldaysInMonth:(NSDate *)date;
/**獲取上一個月*/
+ (NSDate *)lastMonth:(NSDate *)date;
/**獲取下一個月*/
+ (NSDate*)nextMonth:(NSDate *)date;
/**時間戳轉換為時間*/
+ (NSString *) timestampConversionDate:(NSInteger)time Format:(NSString *)format;
/**字符串轉換為時間*/
+ (NSDate *) stringConversionDate:(NSString *)dateStr Format:(NSString *)format;
/**時間轉換為字符串*/
+ (NSString *) dateConversionString:(NSDate *)date Format:(NSString *)format;

@end

自定義類方法的.m文件

#import "YFWLDateManager.h"

@implementation YFWLDateManager

#pragma mark - 日歷方法
+ (NSInteger)day:(NSDate *)date{
    NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [components day];
}

+ (NSInteger)month:(NSDate *)date{
    NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [components month];
}

+ (NSInteger)year:(NSDate *)date{
    NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    return [components year];
}

+ (NSInteger)firstWeekdayInThisMonth:(NSDate *)date{
    NSCalendar *calendar = [NSCalendar currentCalendar];
    
    [calendar setFirstWeekday:1];//1.Sun. 2.Mon. 3.Thes. 4.Wed. 5.Thur. 6.Fri. 7.Sat.
    NSDateComponents *comp = [calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay) fromDate:date];
    [comp setDay:1];
    NSDate *firstDayOfMonthDate = [calendar dateFromComponents:comp];
    
    NSUInteger firstWeekday = [calendar ordinalityOfUnit:NSCalendarUnitWeekday inUnit:NSCalendarUnitWeekOfMonth forDate:firstDayOfMonthDate];
    return firstWeekday - 1;
}

+ (NSInteger)totaldaysInThisMonth:(NSDate *)date{
    NSRange totaldaysInMonth = [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:date];
    return totaldaysInMonth.length;
}

+ (NSInteger)totaldaysInMonth:(NSDate *)date{
    NSRange daysInLastMonth = [[NSCalendar currentCalendar] rangeOfUnit:NSCalendarUnitDay inUnit:NSCalendarUnitMonth forDate:date];
    return daysInLastMonth.length;
}

+ (NSDate *)lastMonth:(NSDate *)date{
    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
    dateComponents.month = -1;
    NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:date options:0];
    return newDate;
}

+ (NSDate*)nextMonth:(NSDate *)date{
    NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
    dateComponents.month = +1;
    NSDate *newDate = [[NSCalendar currentCalendar] dateByAddingComponents:dateComponents toDate:date options:0];
    return newDate;
}

///時間戳轉換為時間
+ (NSString *) timestampConversionDate:(NSInteger)time Format:(NSString *)format{
    NSDate *date=[NSDate dateWithTimeIntervalSince1970:time];
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:format];
    NSString *timeStr=[dateformatter stringFromDate:date];
    return timeStr;
}

///字符串轉換為時間
+ (NSDate *) stringConversionDate:(NSString *)dateStr Format:(NSString *)format{
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:format];
    NSDate *timeStr=[dateformatter dateFromString:dateStr];
    return timeStr;
}

///時間轉換為字符串
+ (NSString *) dateConversionString:(NSDate *)date Format:(NSString *)format{
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:format];
    NSString *timeStr=[dateformatter stringFromDate:date];
    return timeStr;
}

自定義Excel的效果視圖

達到效果

上下滾動時最上面一行保持不動,左右滾動時最左面一行保持不動,可以斜向滾動。
注:僅供參考,方法比較笨,拋磚引玉,希望大神指點

設計思路導圖

思路導圖.png

參考源碼

#import "ZTFormViewController.h"
#import "ZTRoomInfoCollectionViewCell.h"
#import "ZTRoomTitleCollectionViewCell.h"
#import "ZTRoomFilterCollectionViewCell.h"

@interface ZTFormViewController ()<UICollectionViewDelegateFlowLayout, UICollectionViewDataSource,UIGestureRecognizerDelegate>

@property (nonatomic, strong) UIView *headView;
@property (nonatomic, strong) UIView *filterView;
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) UILabel *codeLabel;
@property (nonatomic, strong) UIScrollView *contentScrollView;   //內容容器
@property (nonatomic, strong) UICollectionView *topScrollView;    //頭部滾動
@property (nonatomic, strong) UICollectionView *leftScrollView;   //左邊滾動
@property (nonatomic, strong) UICollectionView *collectionView;   //內容視圖

@property (nonatomic, strong) NSMutableArray *leftArray;//左邊數組
@property (nonatomic, strong) NSMutableArray *infoArray;//數據數組
@property (nonatomic, strong) NSDate *currentDate;


@property (nonatomic, assign) CGPoint lastOffSet;
@property (nonatomic, assign) BOOL isApartment;
@property (nonatomic, strong) NSString *currentApartID;
@property (nonatomic, strong) NSString *currentHouseID;
@property (nonatomic, strong) NSString *currentMonth;
@property (nonatomic, strong) NSString *nextMonth;

@end

@implementation ZTFormViewController
{
    NSInteger _isNextMonth;
}

- (NSMutableArray *)leftArray {
    if (!_leftArray) {
        _leftArray = [[NSMutableArray alloc]init];
    }
    return _leftArray;
}

- (NSMutableArray *)infoArray {
    if (!_infoArray) {
        _infoArray = [[NSMutableArray alloc]init];
    }
    return _infoArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.currentDate = [NSDate date];
    self.isApartment = YES;
    _isNextMonth = 0;
    [self navigationBarSetting];
    [self setLabelFC];
    [self leftCollectionViewSetting];
    [self topCollectionViewSetting];
    [self scrollViewSetting];
    [self collectionViewSetting];
}

- (void)viewWillDisappear:(BOOL)animated {
    [super viewWillDisappear:animated];
    [YFWLHUDManager dismiss];
    _bgView.hidden = YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

#pragma mark - 導航欄設計
- (void)navigationBarSetting {
    self.titleLable.text = @"房態";
    self.leftArray = [[NSMutableArray alloc]initWithObjects:@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"",@"", nil];
    self.view.backgroundColor = [UIColor appBackgroundColor];
    [self.leftButton setImage:[UIImage imageNamed:@"yf_1刷新"] forState:UIControlStateNormal];
    self.leftButton.size = CGSizeMake(Size(24), Size(24));
    self.leftButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
    [self addLeftButtonFouncation:@selector(leftButtonClick)];
}
- (void) leftButtonClick {
    
}

- (void) setLabelFC {
    self.codeLabel = [YFWLFactoryClass CreateLabel:@"房間/日期" FontSize:Size(14) FontColor:[UIColor appBlackTextColor] TextAligment:NSTextAlignmentCenter ToView:self.view];
    self.codeLabel.backgroundColor = [UIColor appHeadBgColor];
    [self.codeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.equalTo(self.view);
        make.width.mas_equalTo(Size(72));
        make.height.mas_equalTo(Size(44));
    }];
}

#pragma mark - 布局滾動視圖
- (void) scrollViewSetting {
    self.contentScrollView = [[UIScrollView alloc]init];
    self.contentScrollView.showsVerticalScrollIndicator = NO;
    self.contentScrollView.showsHorizontalScrollIndicator = NO;
    self.contentScrollView.scrollEnabled = YES;
    self.contentScrollView.directionalLockEnabled = YES;
    self.contentScrollView.bounces = NO;
    self.contentScrollView.delegate = self;
    self.contentScrollView.backgroundColor = [UIColor appBackgroundColor];
    [self.view addSubview:self.contentScrollView];
    [self.contentScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(self.view);
        make.left.equalTo(self.topScrollView);
        make.top.equalTo(self.leftScrollView);
        make.bottom.equalTo(self.view).offset(-self.tabBarController.tabBar.height);
    }];
    
}

#pragma mark - CollectionView
- (void) collectionViewSetting {
    //布局
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(Size(72),Size(52));
    flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
    flowLayout.minimumLineSpacing = 1;
    flowLayout.minimumInteritemSpacing = 1;
    
    //創建collectionView
    self.collectionView = [[UICollectionView alloc]initWithFrame:CGRectMake(0,0,kMainScreenWidth,kMainScreenHeight) collectionViewLayout:flowLayout];
    self.collectionView.showsHorizontalScrollIndicator = NO;
    self.collectionView.showsVerticalScrollIndicator = NO;
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    self.collectionView.scrollEnabled = NO;//appCuttingLineColor
    self.collectionView.backgroundColor = [UIColor appBackgroundColor];
    [self.contentScrollView addSubview:self.collectionView];
    
    //注冊cell
    [self.collectionView registerClass:[ZTRoomInfoCollectionViewCell class] forCellWithReuseIdentifier:@"RoomInfoCell"];
}
- (void) topCollectionViewSetting {
    //布局
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(Size(72),Size(44));
    flowLayout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
    flowLayout.minimumLineSpacing = 1;
    flowLayout.minimumInteritemSpacing = 1;
    
    //創建collectionView
    self.topScrollView = [[UICollectionView alloc]initWithFrame:CGRectMake(Size(73),0,kMainScreenWidth,Size(44)) collectionViewLayout:flowLayout];
    self.topScrollView.showsHorizontalScrollIndicator = NO;
    self.topScrollView.showsVerticalScrollIndicator = NO;
    self.topScrollView.delegate = self;
    self.topScrollView.dataSource = self;
    self.topScrollView.scrollEnabled = NO;
    self.topScrollView.backgroundColor = [UIColor appBackgroundColor];
    [self.view addSubview:self.topScrollView];
    [self.topScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.codeLabel.mas_right).offset(1);
        make.top.equalTo(self.headView.mas_bottom);
        make.right.equalTo(self.view);
        make.height.mas_equalTo(Size(44));
    }];
    
    //注冊cell
    [self.topScrollView registerClass:[ZTRoomTitleCollectionViewCell class] forCellWithReuseIdentifier:@"RoomTimeCell"];
}
- (void) leftCollectionViewSetting {
    //布局
    UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc]init];
    flowLayout.itemSize = CGSizeMake(Size(72),Size(52));
    flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
    flowLayout.minimumLineSpacing = 1;
    flowLayout.minimumInteritemSpacing = 1;
    
    //創建collectionView
    self.leftScrollView = [[UICollectionView alloc]initWithFrame:CGRectMake(0,Size(45),Size(72),kMainScreenHeight) collectionViewLayout:flowLayout];
    self.leftScrollView.showsHorizontalScrollIndicator = NO;
    self.leftScrollView.showsVerticalScrollIndicator = NO;
    self.leftScrollView.delegate = self;
    self.leftScrollView.dataSource = self;
    self.leftScrollView.scrollEnabled = NO;
    self.leftScrollView.backgroundColor = [UIColor appBackgroundColor];
    [self.view addSubview:self.leftScrollView];
    [self.leftScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.view);
        make.top.equalTo(self.codeLabel.mas_bottom).offset(1);
        make.width.mas_equalTo(Size(72));
        make.bottom.equalTo(self.view).offset(-self.tabBarController.tabBar.height);
    }];
    
    //注冊cell
    [self.leftScrollView registerClass:[ZTRoomTitleCollectionViewCell class] forCellWithReuseIdentifier:@"RoomNameCell"];
}

#pragma mark - collectionView代理
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    if (collectionView == self.collectionView) {
        NSInteger roomCount = self.leftArray.count;
        NSInteger day = [YFWLDateManager totaldaysInMonth:self.currentDate];
        self.contentScrollView.contentSize = CGSizeMake(Size(72)*day+day-1, Size(52)*(roomCount-1)+roomCount-1);
        self.collectionView.frame = CGRectMake(0,0,Size(72)*day+day-1,Size(52)*(roomCount)+roomCount-1);
        return roomCount*day;
    }
    if (collectionView == self.leftScrollView) {
        return self.leftArray.count;
    }
    return [YFWLDateManager totaldaysInMonth:self.currentDate];
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    if (collectionView == self.leftScrollView) {
        ZTRoomTitleCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RoomNameCell" forIndexPath:indexPath];
        cell.backgroundColor = [UIColor colorWithRGB:Color(FAFAFA)];
        if (self.leftArray.count > indexPath.row) {
            cell.roomNameLabel.text = @"大床房";
            cell.roomNumberLabel.text = @"520";
        }
        return cell;
    }
    if (collectionView == self.topScrollView) {
        ZTRoomTitleCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RoomTimeCell" forIndexPath:indexPath];
        cell.userInteractionEnabled = NO;
        cell.backgroundColor = [UIColor appHeadBgColor];
        cell.roomNameLabel.font = [UIFont systemFontOfSize:Size(14)];
        cell.roomNameLabel.text = [self currentMD:indexPath];
        cell.roomNumberLabel.font = [UIFont systemFontOfSize:Size(12)];
        cell.roomNumberLabel.text = [self weekStr:[self currentMD:indexPath]];
        if ([[self weekStr:[self currentMD:indexPath]] isEqualToString:@"今天"]) {
            cell.roomNameLabel.textColor = [UIColor appMainColor];
            cell.roomNumberLabel.textColor = [UIColor appMainColor];
        }else {
            cell.roomNameLabel.textColor = [UIColor appGrayTextColor];
            cell.roomNumberLabel.textColor = [UIColor appGrayTextColor];
        }
        return cell;
    }
    
    ZTRoomInfoCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"RoomInfoCell" forIndexPath:indexPath];
    NSInteger row = indexPath.row / [YFWLDateManager totaldaysInMonth:self.currentDate];
    if (row < self.leftArray.count) {
        [cell changeStatus:@""];
    }
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView {
    self.lastOffSet = scrollView.contentOffset;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView {
    if (scrollView == self.contentScrollView) {
        if (scrollView.contentOffset.x - self.lastOffSet.x != 0) {
            [self.topScrollView setContentOffset:CGPointMake(scrollView.contentOffset.x, 0)];
            
        }
        if (scrollView.contentOffset.y - self.lastOffSet.y != 0) {
            [self.leftScrollView setContentOffset:CGPointMake(0, scrollView.contentOffset.y)];
        }
    }
}

- (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section {
    return UIEdgeInsetsMake(0, 0, 0, 0);
}

#pragma mark - 日期
- (NSString *) currentMD:(NSIndexPath *)indexPath {
    NSInteger day = (indexPath.row)%([YFWLDateManager totaldaysInMonth:self.currentDate])+1;
    NSDateFormatter *dateformatter=[[NSDateFormatter alloc] init];
    [dateformatter setDateFormat:@"MM"];
    NSString *month = [dateformatter stringFromDate:self.currentDate];
    if (day < 10) {
        return [NSString stringWithFormat:@"%@-0%lu",month,day];
    }else {
        return [NSString stringWithFormat:@"%@-%lu",month,day];
    }
}
- (NSString *) weekStr:(NSString *)dateStr {
    //需要轉換的字符串
    NSString *dateString = [NSString stringWithFormat:@"%lu-%@",[YFWLDateManager year:self.currentDate],dateStr];
    //設置轉換格式
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
    [formatter setDateFormat:@"yyyy-MM-dd"];
    //NSString轉NSDate
    NSDate *date=[formatter dateFromString:dateString];
    if ([dateString isEqualToString:[formatter stringFromDate:[NSDate date]]]) {
        return @"今天";
    }
    NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
    [dateFormat setDateFormat:@"EEE"];
    NSString *weekStr = [dateFormat stringFromDate:date];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSArray *languages = [defaults objectForKey:@"AppleLanguages"];
    NSString *currentLanguage = [languages objectAtIndex:0];
    if ([currentLanguage isEqualToString:@"zh_Hans"]) {
        NSString *weekRstr = [NSString stringWithFormat:@"周%@",[weekStr substringFromIndex:weekStr.length-1]];
        return weekRstr;
    }else {
        return weekStr;
    }
}

實現效果gif

實現效果.gif

日歷的實現

效果圖

效果圖

核心方法

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    return 42;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    ZTPriceMgmCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"PriceMgmCell" forIndexPath:indexPath];
    NSInteger daysInThisMonth = [YFWLDateManager totaldaysInMonth:_currentDate];
    NSInteger firstWeekday = [YFWLDateManager firstWeekdayInThisMonth:_currentDate];
    
    NSInteger day = 0;
    NSInteger i = indexPath.row;
    cell.topView.backgroundColor = [UIColor whiteColor];
    cell.boView.backgroundColor = [UIColor whiteColor];
    cell.selected = NO;
    if (i < firstWeekday) {
        [cell.dateLabel setText:@""];
        cell.userInteractionEnabled = NO;
        cell.boView.hidden = YES;
    }else if (i > firstWeekday + daysInThisMonth - 1){
        [cell.dateLabel setText:@""];
        cell.userInteractionEnabled = NO;
        cell.boView.hidden = YES;
    }else{
        day = i - firstWeekday + 1;
        NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
        [dateFormatter setDateFormat:@"yyyy-MM-dd"];
        NSString *dayStr = [NSString stringWithFormat:@"%lu",day];
        [cell.dateLabel setText:dayStr];
        if (day < 10) {
            dayStr = [NSString stringWithFormat:@"0%lu",day];
        }
        NSInteger month = [YFWLDateManager month:self.currentDate];
        NSString *selectDate = [NSString stringWithFormat:@"%lu-%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
        if (month < 10) {
            selectDate = [NSString stringWithFormat:@"%lu-0%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
        }
        NSComparisonResult result = [[dateFormatter dateFromString:self.startDate] compare:[dateFormatter dateFromString:selectDate]];
        if (result == NSOrderedDescending) {
            cell.userInteractionEnabled = NO;
            cell.boView.hidden = YES;
        }else if (result == NSOrderedSame) {
            cell.userInteractionEnabled = NO;
            cell.boView.hidden = NO;
            cell.selected = YES;
            cell.priceLabel.text = @"開始";
            cell.priceLabel.textColor = [UIColor appMainColor];
        }else {
            cell.boView.hidden = YES;
        }
    }
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
    [dateFormatter setDateFormat:@"yyyy-MM-dd"];
    NSInteger firstWeekday = [YFWLDateManager firstWeekdayInThisMonth:_currentDate];
    NSInteger day = 0;
    NSInteger i = indexPath.row;
    day = i - firstWeekday + 1;
    NSString *dayStr = [NSString stringWithFormat:@"%lu",day];
    if (day < 10) {
       dayStr = [NSString stringWithFormat:@"0%lu",day];
    }
    NSInteger month = [YFWLDateManager month:self.currentDate];
    NSString *selectDate = [NSString stringWithFormat:@"%lu-%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
    if (month < 10) {
        selectDate = [NSString stringWithFormat:@"%lu-0%lu-%@",[YFWLDateManager year:self.currentDate],month,dayStr];
    }
    NSComparisonResult result = [[dateFormatter dateFromString:self.startDate] compare:[dateFormatter dateFromString:selectDate]];
    if (result == NSOrderedDescending || result == NSOrderedSame) {
        [YFWLHUDManager showInfoMessage:@"不能小于或等于開始時間" duration:1.6];
    }else {
        if (self.ReverseValueBlock) {
            self.ReverseValueBlock(selectDate);
        }
        [self leftButtonClick];
    }
}

搜索框設計

- (void) setupSearchBar {
    
    self.searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, kMainScreenWidth-Size(50), Size(30))];
    self.searchBar.placeholder = @"手機號/訂單號";
    [self.searchBar setValue:@"取消" forKey:@"_cancelButtonText"]; //取消設置為中文
    self.searchBar.keyboardType = UIKeyboardTypeDefault;
    self.searchBar.searchBarStyle = UISearchBarStyleProminent;
    self.searchBar.delegate = self;
    self.searchBar.tintColor = [UIColor whiteColor];
    self.searchBar.barTintColor = [UIColor appBackgroundColor];
    self.searchBar.returnKeyType = UIReturnKeySearch;
    UIView* backgroundView = [self.searchBar subViewOfClassName:@"_UISearchBarSearchFieldBackgroundView"];
    backgroundView.layer.cornerRadius = Size(15);
    backgroundView.clipsToBounds = YES;
    self.navigationItem.titleView = self.searchBar;
}

去除NSArray中的重復對象

NSArray *newArr = [oldArr valueForKeyPath:@“@distinctUnionOfObjects.self"];

防止離屏渲染為image添加圓角

// image分類
- (UIImage *)circleImage {
    // NO代表透明
    UIGraphicsBeginImageContextWithOptions(self.size, NO, 1);
    // 獲得上下文
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    // 添加一個圓
    CGRect rect = CGRectMake(0, 0, self.size.width, self.size.height);
    // 方形變圓形
    CGContextAddEllipseInRect(ctx, rect);
    // 裁剪
    CGContextClip(ctx);
    // 將圖片畫上去
    [self drawInRect:rect];
    UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return image;
}

上線的問題綜述

  • Does your application access any paid content?
    答: NO
  • Who is the target audience?
    答: 需要使用此工具的用戶
  • How do users obtain an account?
    答: 一個用戶注冊一個賬號,創建一個企業或油廠,此賬號作為Agent賬號
    答: 其他用戶注冊賬號,申請加入到一個企業或油廠,Agent 審核是否同意此賬號加入,并給予分配角色
  • Is this app meant for internal distribution in your own company, in the company of one target client, or in multiple target clients’ companies?
    答: in the company of one target client
  • In which countries will this app primarily be distributed?
    答: 中國
  • If this app is meant for internal distribution, will the app be accessible by both internal and external partners? Or will it be exclusive to in-house employees?
    答: both internal and external partners by adding them to a project group
最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 230,182評論 6 543
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 99,489評論 3 429
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 178,290評論 0 383
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,776評論 1 317
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 72,510評論 6 412
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,866評論 1 328
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,860評論 3 447
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 43,036評論 0 290
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,585評論 1 336
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 41,331評論 3 358
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,536評論 1 374
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 39,058評論 5 363
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,754評論 3 349
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 35,154評論 0 28
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 36,469評論 1 295
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 52,273評論 3 399
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,505評論 2 379

推薦閱讀更多精彩內容