Friday, December 25, 2009

Fliping between pages on iPhone

For my project I wanted to have an info screen (really, I did!). After some looking around I found a great video tutorial on how to do this. I creates a separate nib (.xib) file and loads it based on pushing buttons. It also incorporates accessing variables in other .m files which will be useful to me sooner that I had though now that I know it's easy to do.

The only word of caution on the video is that is a little dated and Apple has made some modifications to the way both the IB and xcode work. Specifically, it does things for you now. I'm a total noob to this stuff, so I'm sure the next person will will not have a problem. Just remember that it is different, and you only need to make two files, not 6. When you create the SecondView files, you can create the .h and .xib files all at once. The old xcode required you to make all three separately. IB just looks a little different is all.

Have fun!

Sunday, December 20, 2009

iPhone image hiding

I wanted to display a little red "X" when someone didn't enter all of the fields, but was having a hard time using the .hidden label. I finally found a really good post that I'll link here, and I'll also summarize for you.

This works for UITextField and I'm sure other objects as well.

Hide an object

Here are the basics.
  1. In your .h file for your view. In the same section as @interface enter: IBOutlet UIImageView *imageBadInput;
  2. Just below the interface section enter: @property (nonatomic, retain) IBOutlet UIImageView *imageBadInput;
  3. Now move to the .m file for you view and after @implementation enter : @synthesize imageBadInput;
  4. In the body of this file enter the following to hide the object, and use the NO form to display it: imageBadInput.hidden = YES;
  5. Save these files (they will be grey in the list on the left if they are not saved).
  6. Open up Interface Builder with your nib (.xib) file. Ctrl-click and drag either the File Owner, or the ViewController (depends on how you are building your app).
  7. Drag the blue line over to the graphic you want, and drop it once highlighted.
  8. You now have the option to select the outlet you created in step 1
  9. If you have created several of them, they will all be available. Objects already connected have a "-" before them.
  10. Save the nib file, and build as normal.
If you want to hide these objects unless there is a problem, you can implement this in your views .m file to hide the objects when the view loads.

- (void)viewDidLoad {
imageBadInput.hidden = YES;

Thursday, December 17, 2009

iPhone dev learning all the time

Here are a few things I learned today.

How to exit out of a function. "return;" though one I know.

How to move from one textField to another textField for input using the Next button on the keyboard (Done and Return works also). Just put this in with releasing the keyboard "[field2TextField becomeFirstResponder];"
Thanks flexicoder for this.

I needed to use some regular expressions to find information in the server replies that I'm working with. I'm hoping to figure out how this stuff can be used with xml, but for now I'm using RegexKitLite Framework. Seems to work well, and it's just a .h and .m file to add to the project.

Saturday, December 12, 2009

iPhone XML interface application - Part 1

I'm building an iPhone application that will interface with some networking equipment to pull status data and display it on the screen. The basic components (I think) of this are using http POST, managing a cookie, and reading the xml output from the POST command. I also need to enter a small amount of data in on the phone (server, username, password) so I need to learn how to do some of those things as well.

Some of the things I'm working on so far are:

1. Taking the text input (server url address) on the iPhone and forming that into something to make the actual http query/POST.

2. A framework for working with HTTP that includes POST.

Long time since last update..

The house didn't get built. Long story, so I won't go into it.

On to my next project. An iPhone application. I finally found a use for one that someone has not already built. I need to learn a lot about iPhone apps on top of objective C. Fortunately, my C background from years ago is mostly applicable, and what I want to do is not rocket science. I keep finding tutorials etc. that I want to keep track of, so I'm going to use this blog to do that. If it only get's referenced by me, so be it. If someone finds the information useful, then that's just great.