Hello,

I'm new in objective C programming. I try to do a program where a user can 
choose the number of partitions of a range in the code appears like "valor = 
30" (number of rows in table), this range can be change from 1 to 100 only by 
the user, the main goal is using a NSTableView to show squares with its 
respective calculated value (drawing both in each cell), the total number of 
rows contained in the table will be manipulated by the user in "valor", but 
every cell must have different data. So if this program works fine, every 
square look like a color degradation, beginning in green, passing through brown 
to achieve red like maximum (you can see the image attached).
The question is how can just draw one time every cell without change values in 
my table view?, because every time I click outside my XCode project appears in 
my Log View changes and makes me think that the table's work never stops and 
every time change colors in my table view. Is necessary to use an scroll to 
check the completely squares and values on the table, it appears but not works.

I attached my controller class.

I don't know what should I do, I really appreciate some help please.
Thanks,

Priscila Jardón.

_________________________________________________________________
Inédit ! Des Emoticônes Déjantées! Installez les dans votre Messenger ! 
http://www.ilovemessenger.fr/Emoticones/EmoticonesDejantees.aspx

<<attachment: pic2.jpg>>

{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf480
{\fonttbl\f0\fnil\fcharset77 Verdana;\f1\fnil\fcharset77 Monaco;}
{\colortbl;\red255\green255\blue255;\red51\green51\blue51;\red118\green15\blue80;\red0\green0\blue255;
\red35\green110\blue37;\red137\green19\blue21;}
\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\deftab720
\pard\pardeftab720\ql\qnatural

\f0\fs22 \cf2 This is the code in my controller class.\
\
\pard\tx480\tx960\tx1440\tx1920\tx2400\tx2880\tx3360\tx3840\tx4320\tx4800\tx5280\tx5760\tx6240\tx6720\tx7200\tx7680\tx8160\tx8640\tx9120\tx9600\tx10080\tx10560\tx11040\tx11520\tx12000\tx12480\tx12960\tx13440\tx13920\tx14400\tx14880\tx15360\tx15840\tx16320\tx16800\tx17280\tx17760\tx18240\tx18720\tx19200\tx19680\tx20160\tx20640\tx21120\tx21600\tx22080\tx22560\tx23040\tx23520\tx24000\tx24480\tx24960\tx25440\tx25920\tx26400\tx26880\tx27360\tx27840\tx28320\tx28800\tx29280\tx29760\tx30240\tx30720\tx31200\tx31680\tx32160\tx32640\tx33120\tx33600\tx34080\tx34560\tx35040\tx35520\tx36000\tx36480\tx36960\tx37440\tx37920\tx38400\tx38880\tx39360\tx39840\tx40320\tx40800\tx41280\tx41760\tx42240\tx42720\tx43200\tx43680\tx44160\tx44640\tx45120\tx45600\tx46080\tx46560\tx47040\tx47520\tx48000\pardeftab720\ql\qnatural\pardirnatural

\f1\fs20 \cf0 \CocoaLigature0 - (\cf3 void\cf0 ) awakeFromNib\
\{\
r=[[NSMutableArray alloc] init];\
g=[[NSMutableArray alloc] init];\
b=[[NSMutableArray alloc] init];\
\
\cf3 for\cf0 (i=\cf4 0\cf0 ;i<\cf4 30\cf0 ;i++)\
\{\
azul = \cf4 0\cf0 ;\
rojo = (\cf4 0.0333333\cf0 )*(i); \cf5 // Here we took 1/valor = .0333333\cf0 \
verde = \cf4 1\cf0 -((\cf4 0.0333333\cf0 )*(i));\
\
[r addObject: [NSString stringWithFormat:\cf6 @"%f"\cf0 , rojo]];\
[g addObject: [NSString stringWithFormat:\cf6 @"%f"\cf0 , verde]];\
[b addObject: [NSString stringWithFormat:\cf6 @"%f"\cf0 , azul]];\
\
\}\
\
i=\cf4 0\cf0 ;\
valor = \cf4 30\cf0 ;\
\
\}\
\
- (\cf3 void\cf0 )applicationWillTerminate:(NSNotification *)notification\
\{\
    [r release];\
	[g release];\
	[b release];\
\}\
\
- (\cf3 int\cf0 )numberOfRowsInTableView:(NSTableView*)table\
\{\
    \cf3 return\cf0  valor;\
\}\
\
- (\cf3 id\cf0 )tableView:(NSTableView*)table objectValueForTableColumn:(NSTableColumn*)col \
row:(\cf3 int\cf0 )rowIndex\
\{\
\
NSString *c1 = [NSString stringWithFormat:\cf6 @"%f"\cf0 , [[r objectAtIndex:i] floatValue]];\
NSString *c2 = [NSString stringWithFormat:\cf6 @"%f"\cf0 , [[g objectAtIndex:i] floatValue]];\
NSString *c3 = [NSString stringWithFormat:\cf6 @"%f"\cf0 , [[b objectAtIndex:i] floatValue]];\
\
// I use files to send colors values to my cell class\
    [c1 writeToFile:\cf6 @"color1.txt"\cf0  atomically:\cf3 NO\cf0  encoding:NSUTF8StringEncoding error:\cf3 nil\cf0 ];\
	[c2 writeToFile:\cf6 @"color2.txt"\cf0  atomically:\cf3 NO\cf0  encoding:NSUTF8StringEncoding error:\cf3 nil\cf0 ];\
	[c3 writeToFile:\cf6 @"color3.txt"\cf0  atomically:\cf3 NO\cf0  encoding:NSUTF8StringEncoding error:\cf3 nil\cf0 ];\
\
PersiaCell * aCustomCell = [[PersiaCell alloc] init];\
i++;\
\
  	[[persiaTable tableColumnWithIdentifier:\cf6 @"theTableColumn"\cf0 ] setDataCell:aCustomCell];\
	[persiaTable reloadData];\
\
  \cf3 return\cf0  aCustomCell;\
  \
\}\
}
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to