UA-17470720-3

Jump to content


Photo
- - - - -

How to set/bind two property values into a single label?

cells models sections

  • Please log in to reply
4 replies to this topic

#1 Balachandhar

Balachandhar

    Experienced Member

  • STV 3.0 Pro
  • PipPipPipPip
  • 87 posts
Reputation: 21
Excellent

Posted 14 June 2015 - 09:27 AM

Hi,

 

I am using SCCustomCell class and created a xib with two label. and did bind with two property(Name and desc). - It is working well.

 

Now, i would like to show combined values into the first field like "<Name> - <Reg no>".  But how can i do it using SCCustomCell cellWithText:nil objectBindingsString:    ???

 

SCCustomCell *customCell = [SCCustomCell cellWithText:nil objectBindingsString:@"1:name;2:desc;" nibName:@"EmpCell"];

 

Can anybody help me on this?

 

Thanks,

bala



#2 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 14 June 2015 - 07:52 PM

Greetings Program!
 

You're going to have to either:

1. Add a third property that contains the concatenated value or;

2. set the text for the label in cellActions.willDisplay.

 

When you use curly brace bindings in the nib, you can place the property between any text and it will bind the value ("Hi {name}!!" = "Hi wizgod!!"). But if you put multiple curly brace properties, STV only replaces the first curly brace property it finds ("{name} - {regNo}" = "wizgod - {regNo}").

 

Wg


  • Tarek likes this

P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#3 wizgod

wizgod

    I'm what you guys call a User

  • STV 5.0 Pro
  • PipPipPipPipPipPipPip
  • 575 posts
  • LocationThe Grid
Reputation: 149
Popular

Posted 15 June 2015 - 10:29 AM

Another possibility is to get fancy with the constraints on multiple labels with the the properties...

 

Wg


P.S. I love Swift... talk Swift.. Never too old school to learn yet another programming language. LOL! ;-)


#4 Tarek

Tarek

    Forum Admin

  • Administrators
  • 3670 posts
Reputation: 452
Popular

Posted 15 June 2015 - 10:53 AM

Hi bala,

 

Have you solved this? I totally second Wg's recommendations.



#5 Balachandhar

Balachandhar

    Experienced Member

  • STV 3.0 Pro
  • PipPipPipPip
  • 87 posts
Reputation: 21
Excellent

Posted 15 June 2015 - 08:53 PM

Thanks Wg, cellActions.willDisplay = ^(SCTableViewCell *cell, NSIndexPath *indexPath) is worked great. Here i modified the cell content as i want.

 

@Tarek: Wg's solution worked! :)

 

thanks

bala







Also tagged with one or more of these keywords: cells, models, sections

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users