Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calendar height increases when I change from week view to month view. #263

Closed
JorgeAGomez opened this issue Apr 11, 2016 · 6 comments
Closed

Comments

@JorgeAGomez
Copy link

Everytime I change from week view to month view the height increases a bit.
How can I fix this?

import "CalendarMainViewController.h"

import "FSCalendar.h"

import "AppDelegate.h"

@interface CalendarMainViewController ()

@Property (nonatomic, strong) AppDelegate *appDelegate;

@EnD

@implementation CalendarMainViewController

  • (void)viewDidLoad {
    [super viewDidLoad];

    self.appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    //Makes the calendar scroll vertically
    //_calendarView.scrollDirection = FSCalendarScrollDirectionVertical;
    //_calendar.appearance.adjustsFontSizeToFitContentSize = NO;
    //_calendar.showsPlaceholders = YES;
    [_calendar selectDate:[NSDate date]];
    _calendar.delegate = self;
    _calendar.dataSource = self;

}

  • (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];

}

-(void) viewWillAppear:(BOOL)animated{
self.tabBarController.title = @"Calendar";
}

-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 0;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.textLabel.text = @"Event";

return cell;
}

//makes sure the height constrains is the adecuate when changing from week view to month view(and vice versa).

  • (void)calendar:(FSCalendar *)calendar boundingRectWillChange:(CGRect)bounds animated:(BOOL)animated
    {
    _calendarViewHeight.constant = CGRectGetHeight(bounds);
    [self.view layoutIfNeeded];
    }

  • (void)calendarCurrentScopeWillChange:(FSCalendar *)calendar animated:(BOOL)animated
    {
    _calendarViewHeight.constant = [calendar sizeThatFits:CGSizeZero].height;
    [self.view layoutIfNeeded];
    }

    //creates an event for the date selected.

  • (IBAction)addEventButton:(id)sender {

}

  • (IBAction)segmentedControl:(id)sender {
    if(_segmentedControl.selectedSegmentIndex == 0){
    _calendar.scope = FSCalendarScopeWeek;
    }
    else{
    _calendar.scope = FSCalendarScopeMonth;
    }

}

@EnD

@WenchaoD
Copy link
Owner

Have you log out the height?

@JorgeAGomez
Copy link
Author

What do you mean by "log out" the height?

I gave the calendar a height constrain. And created the IBOutlet for it.

I was debugging it and I discover that the "row" height increases every time I go from week view to month view. Is there a way to make the row's height stay the same height?

I set the adjustsFontSizeToFitContentSize to NO so that the size of the letter dont increase. But the letters size increase because the row increases. If I can make the rows to stay the same height it would fix everything.

Any comments or feedbacks on this?

Here are the screenshots:

screenshot 2016-04-12 14 11 35

screenshot 2016-04-12 14 12 28

Jorge Gomez

On Apr 11, 2016, at 7:34 PM, Wenchao Ding notifications@github.com wrote:

Have you log out the height?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

@WenchaoD
Copy link
Owner

You said 'the height increases a bit', I mean have you use NSLog to print the height

@JorgeAGomez
Copy link
Author

I discover that the problem is not with the height of the calendar view but with the height of the rows.
Everytime I change go from week-view to month-view constantly, the row's height start increasing.

I tried to print the height of the rows but I cant. I don't see where the rows height is being stored.

any comments or feedbacks?

Thanks

@WenchaoD
Copy link
Owner

Never mind. Can you make an example that reproduces this issus and create a dropbox link or wetransfer link?

@Khushtar786
Copy link

Khushtar786 commented Mar 25, 2020

How we can Change When we click on DayviewButton so change to day View and When we Click on MonthView so then change to Month View
E019612F-3388-4DE1-ACFD-30C6352E1847

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants