This is a migrated thread and some comments may be shown as answers.

Customize Inline Events

1 Answer 46 Views
Calendar
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Thomas
Top achievements
Rank 1
Thomas asked on 02 Sep 2016, 08:09 PM

Hi,

I am trying to customize the inline events, and somehow it doesnt work like I want it.

Here (http://www.telerik.com/forums/how-to-customize-the-inline-event-template-of-telerik-calendar-for-ios) I have found the code to do it. It is actually a pretty simple piece of code:

@interface MyInlineView : TKCalendarInlineView

@end

@implementation MyInlineView

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
    TKCalendarEvent *event = self.dayCell.events[indexPath.row];
    cell.textLabel.text = event.title;
    return cell;
}

 

I placed this code inside the same file where my calendarview is.

My problem is that I dont get how this code can work like expected.  First, I cant attach a tableView, it is comming from "inside", thats ok with me, but how can than dequeueReusableCellWithIdentifier work for a custom cell ? The cell should be inside the table view in order to reuse it, which it isnt, bcz I am not able to change the used tableview (so acatually every time the cell is being created, and dequeueReusableCellWithIdentifier is obsolete). But this is also not working, bcz after I create my custom cell all the controls are nil (thats expected bcz they are weak references ...)

 

Am I missing smt here, and can someone tell me how to implement a custom cell ?

 

Thanks,

 

Regards

1 Answer, 1 is accepted

Sort by
0
Adrian
Telerik team
answered on 08 Sep 2016, 09:16 AM
Hello, Thomas,

I apologize for the late reply.
You can register for custom cell by overriding the init method of the custom inline view:
- (instancetype)init
{
    self = [super init];
    if (self) {
        [self.tableView registerClass:MyCell.class forCellReuseIdentifier:@"CustomCell"];
    }
    return self;
}

I hope this helps.

Regards,
Adrian
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Calendar
Asked by
Thomas
Top achievements
Rank 1
Answers by
Adrian
Telerik team
Share this question
or