UA-17470720-3

Jump to content


Photo
- - - - -

How to detect tapping on green (+) button in cell


  • Please log in to reply
7 replies to this topic

#1 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 04 June 2016 - 10:34 PM

Hi,

 

I have an SCArrayOfObjects section which I added an addButtonCell to (SCLabel). I have a cellAction which displays my custom view controller when the cell is selected.

 

But how do I handle the tapping of the green (+) button?

 

Right now it displays a blank view with a cancel and done button.



#2 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 05 June 2016 - 07:48 AM

Hi Brendan,

 

An SCArrayOfObjectsSection should automatically handle when the user taps its addNewItemCell by providing a detail view where the user is able to create a new object. I am not sure why you're getting a blank screen, but my guess is that you provided the section with a misconfigured data definition. Are you doing this in code or visually in IB?



#3 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 05 June 2016 - 10:48 PM

I've already got a view controller that adds the new item. I want to manage that myself and not have SCTV do it for me in this situation. When you tap the row it works properly because I can implement didSelect on the cellActions, but I can't seem to figure out how to get the (+) button to let me do the same thing.



#4 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 06 June 2016 - 05:32 AM

Ok I got it now. Does removing the editing style work for you? If it doesn't, then we can provide  a new action for you to allow you to perform custom actions on different editing styles.

 

Here is what your code should look like:

 

myAddButton.cellActions.customEditingStyle = ^UITableViewCellEditingStyle(SCTableViewCell *cell, NSIndexPath *indexPath)
{
    return UITableViewCellEditingStyleNone;
};


#5 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 06 June 2016 - 12:39 PM

Well, I lose the green (+) button when I do that and I like that being there.

 

A custom action for different editing styles would be fantastic.



#6 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 06 June 2016 - 12:45 PM

Although I suppose I could just add a green (+) icon to the left of the label and that would suffice. I'll do that for now and if you have time to add the custom behaviour, that would be great. If not, no worries.



#7 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 06 June 2016 - 12:48 PM

Although if Apple ever decides to change the look of those editing style buttons, my app would appear wrong.



#8 Brendan Duddridge

Brendan Duddridge

    Advanced Member

  • STV 5.0 Pro
  • PipPipPipPipPip
  • 170 posts
Reputation: 7
Good

Posted 06 June 2016 - 02:01 PM

I've worked around it for now by making a green (+) button that looks like Apple's.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users