This video says "MacRuby has a special syntax" for Obj-C selectors. That isn't true - the colon in ruby 1.9 is used for mapping a symbol to a value. So, in regular ruby 1.9:
{key: 'val'} is the same as {:key => 'val'}
and
method(key: 'val') is the same as method(:key => 'val')
MacRuby just translates the hash that it gets as a parameter int an Obj-C selector when calling the real function.
I am a newbie and I have a doubt on how I would have access to a didSelectRowAtIndex. Where would I need to include it and will it need a special implementation?
I recently upgraded to 3.0 for the iphone dev environment. This technique doesn't work as far as I can tell - although I suppose it could just be my machine... I hold the image over Safari, and nothing happens...
Thanks. I created a tab bar application from O'Reilly's tutorial; and trying to get this table view to work in one of the tabs. The problem is that there are now two view controllers that are redundant. How would you go about integrating these two methods? Or alternatively how would you put this in a tab?
thanks for creating this great tutorial. I wasn't aware, that the support for ruby is already THAT great. I love it. I'm basically in c# at work and do mac&iPhone-programming in my spare-time and I definately missed the powerfull ruby-one-liners (e.g. modifying specific elements in an array via a passed-in block)
Thanks for the great tutorials!
I've got a question.
You talked about decoupling -- a great thing for keeping the code clean. I wondered, why you hardcoded the specific row-height into the app instead of letting it depend on the height of the cell in the nib.
Do you have a reason for that?
Don't get me wrong - I don't plan to critisize you; I just wanna know ;-)
Regards,
Florian
Hi. Great tutorial! But when I tried running it with the Instruments checking for leaks, it said it was leaking. I'm not an expert in Instruments so I'm not sure is something that is autoreleased still shows up as leaks--so maybe that's the case. Anyway, I'm just wondering if you checked this "Custom Table Cells in Interface Builder" project with Instruments and confirmed there are no leaks? Anyway, thanks mucho--and I bought your XCode screencast by the way.
That sounds like a problem specific to the yaml library and its use of stringio.bundle. I've been able to use other standard Ruby libraries. Hopefully a future version of MacRuby will smooth this out.
Thank you very much. I've been struggling with some very complex forms in UITableViews, and between this (which I never really "got" before) and Matthew Gallagher's GenericTableView method of refactoring Table Views, my code bloat has dropped significantly. One note for future viewers of the screencast... if you plan to use this technique in a grouped style table, the UIView that you place in the background must have its background color set to clear and its opaque property turned to false for the grouped style cell to show properly. Threw me for a little while.
I implemented the didSelectCell method, but when the view appears, none of the labels update. I created a DetailViewController with 3 labels (just like the cell), and I have a configureFromProduct method that's nearly identical to the cell's method.
The labels never update though and I can't figure out why. Any ideas?
I asked about paid content because your screencasts are great and I thought maybe the iphone dev ones might be the start of a more complete class. You do a great job.
Mike, thanks a lot for these high quality free screencasts. Unfortunately for any non trivial application that makes use of the standard library, the embedding doesn't work. For example I tried to require yaml that is dependent on the stringio.bundle. The bundle still refers to MacRuby in /Library/Frameworks. Maybe I'm missing something, but I couldn't distribute my little app to friends without MacRuby installed.
I think your videos are great. I was left with a number of questions i hope you can help with
1.at 15:15 when you are loading the Nib file for ProductTableCell there is a parameter "options" which is never visible on screen. What do you set it to?
2. at 13:58 I can not make the connection from productCell to ProductTableCell. I am sure I got this working when you put the video up but I can't today. I have run through the video a few times and I think I am doing things right. Any idea what not making this connection is caused by?
3. These videos are not yet available as paid products correct? Any idea when they will be?
I probably should have mentioned that you can just copy the MacRuby run script into the main target and make it the final build phase. That means you only have one target to manage, but could be less flexible depending on how you plan to distribute the app.
Another thing I did was to have the load path directive look for the frameworks directory so either target will build whether or not MacRuby has been bundled:
Bonus Track #5: Custom Table Cells in Interface Builder
20. Xandra Hasegawa on Apr 15, 2010 at 01:52Just nice, excellent information and the effort totally not put into waste.
Bonus Track #7: Embedding MacRuby
7. ankara nakliyat on Mar 22, 2010 at 09:45very nice blog :)
Bonus Track #6: MacRuby
12. Adrian on Mar 04, 2010 at 04:09This video says "MacRuby has a special syntax" for Obj-C selectors. That isn't true - the colon in ruby 1.9 is used for mapping a symbol to a value. So, in regular ruby 1.9:
{key: 'val'} is the same as {:key => 'val'}
and
method(key: 'val') is the same as method(:key => 'val')
MacRuby just translates the hash that it gets as a parameter int an Obj-C selector when calling the real function.
Bonus Track #5: Custom Table Cells in Interface Builder
19. Napo on Feb 14, 2010 at 06:19Great tutorial!
How do I add this to an existing view controller (such as the one instructed by O'Reilly), though?
I'm getting all sorts of errors over here. I just need to implement the custom view to an existing table...
Thanks!
Bonus Track #5: Custom Table Cells in Interface Builder
18. James Wald on Jan 28, 2010 at 03:16First time on your site and I am thoroughly impressed with this video. Thanks a lot! Definitely will be watching your other screencasts.
Bonus Track #5: Custom Table Cells in Interface Builder
17. Daniel on Nov 01, 2009 at 10:58Very nice, clean and clear
Bonus Track #5: Custom Table Cells in Interface Builder
16. ldj on Sep 03, 2009 at 20:42Hello,
I am a newbie and I have a doubt on how I would have access to a didSelectRowAtIndex. Where would I need to include it and will it need a special implementation?
thanks
ldj
Bonus Track #3: Adding Photos to the iPhone Simulator
2. John on Aug 25, 2009 at 15:22To answer my own question -- it was my machine. Was having trouble with developer certificate. Once that was fixed, the technique worked fine...
Bonus Track #3: Adding Photos to the iPhone Simulator
1. John on Aug 24, 2009 at 20:59I recently upgraded to 3.0 for the iphone dev environment. This technique doesn't work as far as I can tell - although I suppose it could just be my machine... I hold the image over Safari, and nothing happens...
Can anyone advise?
Bonus Track #7: Embedding MacRuby
6. Reborg on Aug 04, 2009 at 13:26In the meanwhile, here's a workaround: http://reborg.tumblr.com/post/155619150/embedding-macruby
Thanks again
Bonus Track #5: Custom Table Cells in Interface Builder
15. io on Jul 30, 2009 at 19:20re: my tab bar app; I fixed it by using the correct controller ;)
Now, to store the data elsewhere...
Bonus Track #5: Custom Table Cells in Interface Builder
14. Brian on Jul 28, 2009 at 16:08Does anyone read these comments (other than the people making the comments/asking the questions)?
Bonus Track #5: Custom Table Cells in Interface Builder
13. io on Jul 28, 2009 at 13:16Thanks. I created a tab bar application from O'Reilly's tutorial; and trying to get this table view to work in one of the tabs. The problem is that there are now two view controllers that are redundant. How would you go about integrating these two methods? Or alternatively how would you put this in a tab?
Thanks.
Bonus Track #5: Custom Table Cells in Interface Builder
12. brian on Jul 18, 2009 at 23:03Great tutorial. How do i make each row clickable to their own detail view?
Bonus Track #6: MacRuby
11. Florian Witteler on Jul 02, 2009 at 00:11Elroy,
thanks for all your efford into MacRuby! I really appreciate it. Keep up the good work!
Bonus Track #6: MacRuby
10. Florian Witteler on Jul 02, 2009 at 00:10Mike,
thanks for creating this great tutorial. I wasn't aware, that the support for ruby is already THAT great. I love it. I'm basically in c# at work and do mac&iPhone-programming in my spare-time and I definately missed the powerfull ruby-one-liners (e.g. modifying specific elements in an array via a passed-in block)
Bonus Track #5: Custom Table Cells in Interface Builder
11. Florian Witteler on Jul 02, 2009 at 00:03Hi Mike!
Thanks for the great tutorials!
I've got a question.
You talked about decoupling -- a great thing for keeping the code clean. I wondered, why you hardcoded the specific row-height into the app instead of letting it depend on the height of the cell in the nib.
Do you have a reason for that?
Don't get me wrong - I don't plan to critisize you; I just wanna know ;-)
Regards,
Florian
Bonus Track #5: Custom Table Cells in Interface Builder
10. Vipm on Jun 26, 2009 at 02:15Hi. Great tutorial! But when I tried running it with the Instruments checking for leaks, it said it was leaking. I'm not an expert in Instruments so I'm not sure is something that is autoreleased still shows up as leaks--so maybe that's the case. Anyway, I'm just wondering if you checked this "Custom Table Cells in Interface Builder" project with Instruments and confirmed there are no leaks? Anyway, thanks mucho--and I bought your XCode screencast by the way.
Bonus Track #7: Embedding MacRuby
5. Mike Clark on Jun 24, 2009 at 15:24Reborg:
That sounds like a problem specific to the yaml library and its use of stringio.bundle. I've been able to use other standard Ruby libraries. Hopefully a future version of MacRuby will smooth this out.
Thanks for the heads-up, though!
Mike
Bonus Track #5: Custom Table Cells in Interface Builder
9. Matthew Cave on Jun 16, 2009 at 19:57Thank you very much. I've been struggling with some very complex forms in UITableViews, and between this (which I never really "got" before) and Matthew Gallagher's GenericTableView method of refactoring Table Views, my code bloat has dropped significantly. One note for future viewers of the screencast... if you plan to use this technique in a grouped style table, the UIView that you place in the background must have its background color set to clear and its opaque property turned to false for the grouped style cell to show properly. Threw me for a little while.
Bonus Track #5: Custom Table Cells in Interface Builder
8. James on Jun 16, 2009 at 03:21I implemented the didSelectCell method, but when the view appears, none of the labels update. I created a DetailViewController with 3 labels (just like the cell), and I have a configureFromProduct method that's nearly identical to the cell's method.
The labels never update though and I can't figure out why. Any ideas?
James
Bonus Track #5: Custom Table Cells in Interface Builder
7. Mike Clark on Jun 04, 2009 at 09:25Thanks, Greg!
Bonus Track #5: Custom Table Cells in Interface Builder
6. Greg on Jun 01, 2009 at 20:27Mike,
Thanks for the response. I missed the code link.
I asked about paid content because your screencasts are great and I thought maybe the iphone dev ones might be the start of a more complete class. You do a great job.
Thanks,
Greg
Bonus Track #5: Custom Table Cells in Interface Builder
5. Mike Clark on Jun 01, 2009 at 06:54Greg:
1. The options argument is set to nil. Also, you can download the full source code for any screencast using the link in the Resources section.
2. Hrm, are you sure your ProductTableCell is a subclass of UITableViewCell? Perhaps it's not recognizing it as a valid outlet.
3. I'm not planning to charge for these screencasts. Is there a specific reason you're asking about paid content?
Thanks,
Mike
Bonus Track #7: Embedding MacRuby
4. Reborg on May 28, 2009 at 21:36Mike, thanks a lot for these high quality free screencasts. Unfortunately for any non trivial application that makes use of the standard library, the embedding doesn't work. For example I tried to require yaml that is dependent on the stringio.bundle. The bundle still refers to MacRuby in /Library/Frameworks. Maybe I'm missing something, but I couldn't distribute my little app to friends without MacRuby installed.
Bonus Track #5: Custom Table Cells in Interface Builder
4. Greg on May 25, 2009 at 20:38Mike,
I think your videos are great. I was left with a number of questions i hope you can help with
1.at 15:15 when you are loading the Nib file for ProductTableCell there is a parameter "options" which is never visible on screen. What do you set it to?
2. at 13:58 I can not make the connection from productCell to ProductTableCell. I am sure I got this working when you put the video up but I can't today. I have run through the video a few times and I think I am doing things right. Any idea what not making this connection is caused by?
3. These videos are not yet available as paid products correct? Any idea when they will be?
Thanks,
Greg
Bonus Track #7: Embedding MacRuby
3. Mike Clark on May 11, 2009 at 14:21Geoffrey: Ah, thanks, that's a good catch!
I probably should have mentioned that you can just copy the MacRuby run script into the main target and make it the final build phase. That means you only have one target to manage, but could be less flexible depending on how you plan to distribute the app.
Bonus Track #7: Embedding MacRuby
2. Geoffrey Grosenbach on May 11, 2009 at 14:14Very useful!
Another thing I did was to have the load path directive look for the frameworks directory so either target will build whether or not MacRuby has been bundled:
http://gist.github.com/110189
Bonus Track #7: Embedding MacRuby
1. Matt Aimonetti on May 11, 2009 at 13:43Thanks a lot for yet another free MacRuby screencast.
Bonus Track #1: Refactoring: Rename
1. iphone architect on May 11, 2009 at 04:29great tutorial, thanks
keep up the good work