Gold Challenge help for those who need it


#1

I finally finished this one, and was having a ton of difficulty with it. I’m not sure why, because it’s fairly straightforward, but I just wasn’t thinking about it right. Here’s some help I stumbled over for anyone else who’s having a hard time:

thinkvitamin.com/code/ios/custom … ontroller/

The layoutSubviews method of UIView is critical, as is the distinction between frames and bounds. Remember: frames give you coordinates relative to the superview. Getting that wrong cost me 30 minutes of my life I’ll never get back. (But I suppose I’ve learned it now…)


#2

That’s a fantastic article, thanks for posting it Damir! :slight_smile:

I was really lost when working on that challenged and not finding the Apple docs the least bit enlightening.


#3

Wow, I’m impressed !
That’s one difficult challenge, and one brilliant solution !

I’d never have found that by myself.

Thanks for sharing !


#4

Amazing post, although I’m still trying to understand everything (I’m still attempting to get used to CGRect stuff…). When I attempt to use the code… it does not cut up the borders from that one image as it instructs it will… not quite sure how that’s suppose to be done from the code either. The Arrow also displays it’s white background rather being transparent. Is this simply because the one provided isn’t a sprite?


#5

For those of you interested, the article is now here: blog.teamtreehouse.com/customizi … controller

The code needs tweaking if you are using iOs 6. You need to add 2 more cases to the switch in the layoutViews method: UIPopoverArrowDirectionAny, and UIPopoverArrowDirectionUnknown.

Also, you will need to add the CoreGraphics library to your project if you do follow this instructions.


#6

[quote=“coopersita”]For those of you interested, the article is now here: blog.teamtreehouse.com/customizi … controller

The code needs tweaking if you are using iOs 6. You need to add 2 more cases to the switch in the layoutViews method: UIPopoverArrowDirectionAny, and UIPopoverArrowDirectionUnknown.

Also, you will need to add the CoreGraphics library to your project if you do follow this instructions.[/quote]

I used this one too.
Worked for me.
Can’t say that I will be able to repeat this one without google or this article for now, but still… a lot of stuff is going on to make a custom popover.


#7

I was also completely lost with this one until finding this thread…so, many thanks!

I don’t think I learnt very much from this challenge…except to avoid custom popover backgrounds :wink:
I know we sometimes have to rely on the apple documentation as professional programmers, but in this case it was of no help to me. I like the challenges that you have a fair chance to work out for yourself…but for me this one did not qualify.

don’t get me wrong because overall I’m loving the book.

Having used the code in the article, I also saw the white background issue that thegamingart posted…my “fix” was to edit the png file to delete the unwanted pixels.


#8

Thank you very much!