Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 19, 2013, 10:59 AM   #1
Dreamspinner
macrumors member
 
Join Date: Dec 2012
Setting matrix cell state

I have an NSMatrix as 2 radio buttons( 1 col, 2 rows). I need to be able to set one to selected (ON, checked) state. The matrix and both cells have an action which fires when one of the buttons is clicked. The matrix has an outlet, but the cells do not. In the code below, I get the correct tag, but none of the other lines (tried one at a time) have any effect.

Code:
- (IBAction)matrixClick:(id)sender
{
  id theCell = [sender selectedCell];
  int theTag = [theCell tag];

  [[matrixRotor cellAtRow:0 column:0] setState:1];
  [matrixRotor selectCellWithTag:1];
  [matrixRotor  setState:1 atRow:0 column:0];
  NSLog(@"Setting RB");
}
Dreamspinner is offline   0 Reply With Quote
Old Feb 19, 2013, 11:14 AM   #2
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Have you checked everything including the obvious? For example have you checked that matrixRotor is not nil? Also don't use 1, use NSOnState
robbieduncan is offline   0 Reply With Quote
Old Feb 19, 2013, 12:31 PM   #3
Dreamspinner
Thread Starter
macrumors member
 
Join Date: Dec 2012
I don't have a list of 'everything', so no, I haven't. Wouldn't 'the obvious' be a subset of everything?

Seriously, I don't know what else I can check. I put in a test for nil, and it's not.
The use of NSOnState made no difference.
Dreamspinner is offline   0 Reply With Quote
Old Feb 19, 2013, 01:12 PM   #4
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
OK, matrixRotor is not nil. That's a good start. What sort of cell are you using?
robbieduncan is offline   0 Reply With Quote
Old Feb 19, 2013, 01:18 PM   #5
Dreamspinner
Thread Starter
macrumors member
 
Join Date: Dec 2012
Quote:
Originally Posted by robbieduncan View Post
OK, matrixRotor is not nil. That's a good start. What sort of cell are you using?
As I said in the OP, radio buttons.
Dreamspinner is offline   0 Reply With Quote
Old Feb 20, 2013, 11:16 AM   #6
Dreamspinner
Thread Starter
macrumors member
 
Join Date: Dec 2012
Quote:
Originally Posted by robbieduncan View Post
OK, matrixRotor is not nil. That's a good start. What sort of cell are you using?
Quote:
Originally Posted by Dreamspinner View Post
As I said in the OP, radio buttons.
Sorted. You can't change state in a method that responds to a click event of a button. Moved it elsewhere.
Dreamspinner is offline   0 Reply With Quote
Old Feb 20, 2013, 12:29 PM   #7
robbieduncan
Moderator
 
robbieduncan's Avatar
 
Join Date: Jul 2002
Location: London
Quote:
Originally Posted by Dreamspinner View Post
Sorted. You can't change state in a method that responds to a click event of a button. Moved it elsewhere.
Cool. I suppose that makes some sense. The click itself should be changing the state anyway
robbieduncan is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Should I stay a state employee or should I leave and get non-state job? determined09 Community Discussion 28 Aug 25, 2014 11:53 AM
iPhone: Jailbreak Matrix smorris79 Jailbreaks and iOS Hacks 2 Dec 20, 2013 07:33 AM
Happy Birthday cell phone - the first cell phone call occurred 04/03/73 maflynn Community Discussion 11 Apr 5, 2013 03:37 PM
Cell's Image Taking Up All of Cell Dimensions newtoiphonesdk iPhone/iPad Programming 0 Jun 25, 2012 09:52 PM

Forum Jump

All times are GMT -5. The time now is 10:59 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC