FROM : Quincey Morris
DATE : Sun Jun 22 21:44:16 2008
On Jun 22, 2008, at 09:46, William Squires wrote:
> Okay, thanks. It seems to work if I just typecast it to NSString *,
> since the values are coming from an NSTextField as [textField
> stringValue] in my AppController.m when the action is triggered from
> the "Add" buttton.
>
Just typecasting isn't really the answer to your underlying worry
here. After all, if your are passed an object that isn't a NSString,
typecasting it won't help you.
If your implementation of tableView:setObjectValue:forTableColumn:row
expects the value to be a string, it would be better to check if it
isKindOfClass:[NSString class], and assign it to a NSString* local
variable (no cast actually needed) if it is, or handle the error if
it's not.
DATE : Sun Jun 22 21:44:16 2008
On Jun 22, 2008, at 09:46, William Squires wrote:
> Okay, thanks. It seems to work if I just typecast it to NSString *,
> since the values are coming from an NSTextField as [textField
> stringValue] in my AppController.m when the action is triggered from
> the "Add" buttton.
>
Just typecasting isn't really the answer to your underlying worry
here. After all, if your are passed an object that isn't a NSString,
typecasting it won't help you.
If your implementation of tableView:setObjectValue:forTableColumn:row
expects the value to be a string, it would be better to check if it
isKindOfClass:[NSString class], and assign it to a NSString* local
variable (no cast actually needed) if it is, or handle the error if
it's not.
| Related mails | Author | Date |
|---|---|---|
| William Squires | Jun 22, 18:02 | |
| Jeff LaMarche | Jun 22, 18:13 | |
| Daniel Richman | Jun 22, 18:14 | |
| Jens Alfke | Jun 22, 18:22 | |
| William Squires | Jun 22, 18:46 | |
| Quincey Morris | Jun 22, 21:44 |






Cocoa mail archive

