项目作者: PayalUmraliya

项目描述 :
Layout to display time slots in horizontal 24 hour format
高级语言: Objective-C
项目地址: git://github.com/PayalUmraliya/HorizontalTimesLayout.git
创建时间: 2017-06-16T17:16:04Z
项目社区:https://github.com/PayalUmraliya/HorizontalTimesLayout

开源协议:MIT License

下载


HorizontalTimesLayout

License

SWIFT VERSION FOR THIS PROJECT - https://github.com/PayalUmraliya/HorizontalTimesLayout-Swift

TO DISPLAY TIME SLOTS IN 24 HOUR FORMAT

PROJECT CONTAINS IDEA TO DEVELOP A CALENDAR TYPE LAYOUT USING TABLEVIEW IN WHICH IF REQUIREMENTS ARE TO SHOW TIME IN HORIZONTAL LAYOUT AND EVENTS IN VERTICAL LAYOUT.

PROJECT EXAMPLE SHOWING LIST OF RESOURCES USAGE IN 24 HOUR FORMAT.

Sample project output

LICENSE

The MIT License

USAGE
  1. -(void)prepareStatusDic
  2. {
  3. NSArray *arr=[NSArray arrayWithObjects:@"1:40",@"2:40",@"DJ-IL",@"1",nil];
  4. NSArray *arr1=[NSArray arrayWithObjects:@"4:00",@"7:20",@"PJ-IL", @"2",nil];
  5. NSArray *arr2=[NSArray arrayWithObjects:@"3:55",@"12:30",@"PR-IL",@"3", nil];
  6. NSArray *arr3=[NSArray arrayWithObjects:@"17:10",@"23:00",@"PU-IL",@"4", nil];
  7. someDictionary = @{@"0" : arr,@"2" : arr1,@"3" : arr2,@"4" : arr3};
  8. }

Above method will add event with different color in cell

  1. NSArray *arr=[NSArray arrayWithObjects:@"1:40",@"2:40",@"DJ-IL",@"1",nil];
Array Element
  • 1 - start time
  • 2 - End time
  • 3 - Text to display on event
  • 4 - Color of event
Dictionary Element
  1. someDictionary = @{@"0" : arr,@"2" : arr1,@"3" : arr2,@"4" : arr3};
  • Key - index of row at which you want to add event
  • value - event data
This display event call this method in collection view cell for row at index path delegate method
  1. [hsc setUpCellWithArray:[someDictionary objectForKey:[NSString stringWithFormat:@"%ld",(long)cv.tag]]];
  1. - (UICollectionViewCell *)collectionView:(UICollectionView *)cv cellForItemAtIndexPath:(NSIndexPath *)indexPath
  2. {
  3. CellHorizontalScroll *hsc =[cv dequeueReusableCellWithReuseIdentifier:@"CellHorizontalScroll"
  4. forIndexPath:indexPath];
  5. [hsc setBackgroundColor:[UIColor whiteColor]];
  6. [hsc setUpCellWithArray:[someDictionary objectForKey:[NSString stringWithFormat:@"%ld",(long)cv.tag]]];
  7. hsc.cellDelegate = self;
  8. [hsc.scroll setFrame:CGRectMake(hsc.scroll.frame.origin.x, hsc.scroll.frame.origin.y, hsc.frame.size.width, 70 )];
  9. hsc.scroll.contentOffset= CGPointMake(self.collEventTimeHeader.contentOffset.x,0.0);
  10. return hsc;
  11. }
To manage event click event use below custom delegate method of calender cell
  1. -(void)callSelected:(id)sender
  2. {
  3. //Handle click event
  4. }
To customize UI for event use below method
  1. -(UIView *)createCustomView:(NSArray *)array
  2. {
  3. }

:)