<殊途公寓>項(xiàng)目總結(jié)

2017.06.01-2017.07.15

擴(kuò)大UIButton的點(diǎn)擊范圍

CGFloat const touchSize = 44; //蘋果官方默認(rèn)44,小于44則為弱反應(yīng)
CGFloat const sizeMax   = - .5;

@implementation YFWLButton //繼承UIButton的一個(gè)自定義類
///擴(kuò)大點(diǎn)擊范圍
- (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;
/**獲取月數(shù)總天數(shù)*/
+ (NSInteger)totaldaysInThisMonth:(NSDate *)date;
/**獲取月份總天數(shù)*/
+ (NSInteger)totaldaysInMonth:(NSDate *)date;
/**獲取上一個(gè)月*/
+ (NSDate *)lastMonth:(NSDate *)date;
/**獲取下一個(gè)月*/
+ (NSDate*)nextMonth:(NSDate *)date;
/**時(shí)間戳轉(zhuǎn)換為時(shí)間*/
+ (NSString *) timestampConversionDate:(NSInteger)time Format:(NSString *)format;
/**字符串轉(zhuǎn)換為時(shí)間*/
+ (NSDate *) stringConversionDate:(NSString *)dateStr Format:(NSString *)format;
/**時(shí)間轉(zhuǎn)換為字符串*/
+ (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;
}

///時(shí)間戳轉(zhuǎn)換為時(shí)間
+ (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;
}

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

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

自定義Excel的效果視圖

達(dá)到效果

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

設(shè)計(jì)思路導(dǎo)圖

思路導(dǎo)圖.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;   //內(nèi)容容器
@property (nonatomic, strong) UICollectionView *topScrollView;    //頭部滾動(dòng)
@property (nonatomic, strong) UICollectionView *leftScrollView;   //左邊滾動(dòng)
@property (nonatomic, strong) UICollectionView *collectionView;   //內(nèi)容視圖

@property (nonatomic, strong) NSMutableArray *leftArray;//左邊數(shù)組
@property (nonatomic, strong) NSMutableArray *infoArray;//數(shù)據(jù)數(shù)組
@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 - 導(dǎo)航欄設(shè)計(jì)
- (void)navigationBarSetting {
    self.titleLable.text = @"房態(tài)";
    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 - 布局滾動(dòng)視圖
- (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;
    
    //創(chuàng)建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];
    
    //注冊(cè)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;
    
    //創(chuàng)建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));
    }];
    
    //注冊(cè)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;
    
    //創(chuàng)建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);
    }];
    
    //注冊(cè)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 {
    //需要轉(zhuǎn)換的字符串
    NSString *dateString = [NSString stringWithFormat:@"%lu-%@",[YFWLDateManager year:self.currentDate],dateStr];
    //設(shè)置轉(zhuǎn)換格式
    NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
    [formatter setDateFormat:@"yyyy-MM-dd"];
    //NSString轉(zhuǎn)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;
    }
}

實(shí)現(xiàn)效果gif

實(shí)現(xiàn)效果.gif

日歷的實(shí)現(xiàn)

效果圖

效果圖

核心方法

- (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:@"不能小于或等于開始時(shí)間" duration:1.6];
    }else {
        if (self.ReverseValueBlock) {
            self.ReverseValueBlock(selectDate);
        }
        [self leftButtonClick];
    }
}

搜索框設(shè)計(jì)

- (void) setupSearchBar {
    
    self.searchBar = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, kMainScreenWidth-Size(50), Size(30))];
    self.searchBar.placeholder = @"手機(jī)號(hào)/訂單號(hào)";
    [self.searchBar setValue:@"取消" forKey:@"_cancelButtonText"]; //取消設(shè)置為中文
    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中的重復(fù)對(duì)象

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

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

// image分類
- (UIImage *)circleImage {
    // NO代表透明
    UIGraphicsBeginImageContextWithOptions(self.size, NO, 1);
    // 獲得上下文
    CGContextRef ctx = UIGraphicsGetCurrentContext();
    // 添加一個(gè)圓
    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?
    答: 一個(gè)用戶注冊(cè)一個(gè)賬號(hào),創(chuàng)建一個(gè)企業(yè)或油廠,此賬號(hào)作為Agent賬號(hào)
    答: 其他用戶注冊(cè)賬號(hào),申請(qǐng)加入到一個(gè)企業(yè)或油廠,Agent 審核是否同意此賬號(hào)加入,并給予分配角色
  • 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?
    答: 中國(guó)
  • 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
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容