Drawing in a Custom iPhone View Part 1

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
2,227
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on May 10, 2011

This is a first part in a short series demonstrating one way to create a custom UIView that you can draw in. This first short series will demonstrate a method that uses destructive drawing - otherwise, each time you stop then start a new drawing path, the previous path is erased.

This project is written using XCode 4. It is a window based project with a single UIViewController. There is also a subclass of UIView for the custom view that the drawing will take place in.

The series after this will cover a method to handle non-destructive drawing using an offscreen buffer.

If you have any questions, please feel free to ask.

Category:

Howto & Style

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (Nethfel)

  • In this particular video, I was doing all of the linkups within IB as opposed to creating an instance of the root view controller and setting it within the actual source code. Before I had made this video, some people had asked for a demo on having the root view controller instantiated by having it be part of the MainWindow.xib. That's what this does - the system will create an instance of the Master View Controller and connect it to the rootView IVAR.

  • Sorry for not getting back to u the other day but I have a feeling it didn't work for a good reason. Now I have the Xcode 4 but, how did u get your code down the bottom?

  • @peterrory I don't understand the question - what are you trying to ask? What code "down the bottom" and what do you mean by "down the bottom"? BTW - if you're doing this tutorial with XCode 4, you need to make sure to turn off ARC on the project otherwise it won't work right - this code as presented is not for use with ARC.

  • @Nethfel Thanks I take a look. I've only just downloaded it yday so still getting to grips with it. Right what I'm talking about is the layout of the SDK windows/panels? U have your code down the bottom so u drag from object to outlet? My code is next to the IB and I click on the .h file and that goes next to that! I can't see anything to drag!

  • @peterrory Oooohhhh, ok - yeah, that's an easy fix. In XCode, go to the View dropdown -> Assistant Layout -> and select where you want them (in my case I have them set to the bottom of the screen.

  • @Nethfel It wasn't as easy as that but managed it in the end. Now I'm gonna rewrite this one frm scratch and this time it should work! Also the ARC is switched off or not associated to the files until u make this happen manually...

  • @peterrory Actually, ARC is turned on for projects by default (check mark at the beginning) unless you turn it off or specifically tell it to do so for a specific file with -fno-objc-arc (or if you have ARC turned off using -fobjc-arc to turn it on for a specific file)... And really - it is that easy to get the assistant window to show up down below :)

see all

All Comments (12)

Sign In or Sign Up now to post a comment!
  • Another great video, do you write apps or parts of apps for other people? If so what do you charge.

  • You dragged an object into the mainwindow.xib file . Could you please explain that why you did that ? I understood when you dragged a MasterViewController into the delegate file but why the mainwindow.xib ?

  • Now it's just one thing after another! It won't let me drag the IBOutlets? I've googled this but can't find how to do it?

  • @Nethfel Also thank you, you're being really helpful

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more