Customize Inline Events

2 posts, 0 answers
  1. Thomas
    Thomas avatar
    27 posts
    Member since:
    Jul 2016

    Posted 02 Sep Link to this post

    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

  2. Adrian
    Admin
    Adrian avatar
    167 posts

    Posted 08 Sep Link to this post

    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
  3. DevCraft banner
Back to Top