Tue
Mar
9
Here’s the app I couldn’t get working last week. Its a continuation on the concept of rotating the iPhone to in app and the view changing to correspond. Except the difference with this app is that instead of setting out positions for the the buttons to readjust to when the iPhone is rotated, I created two totally different views in IB, a landscape and a portrait. The using the core graphics features that are built into the iPhone SDK we can swap then views depending on the orientation of the iPhone. Very cool really but was definitely the most difficult app I tried so far.
This will be the last post for a while. College exams coming up so the iPhone dev is going to have to be put to one side for a couple of months. But what I’ve learned so far has been awesome and really enjoyed it.
Until next time,
Later;)
No iPhone App this week unfortunatley. Mostly due to the fact I’, having some issues getting it to work. The app is a further step on from the auto rotation app from last week, only this time when the iPhone is rotated its a completely different view thats seen. Anyway I’ll hopefully have it done for next week.
For this week i wanted to say a brief note on some statistics I saw this past week. The iPhone is now third on the list for worldwide Smartphone usage with nearly 15% market share. Symbian based handsets top the list with around 47% market share with Research in Motion a.k.a Blackberry in second with around 20%. This is truely a sign of the greatness of the iPhone. Its one single handset dominating that much when you consider there are hundreds of symbian phones on the market and Blackberry always have 20 plus different handsets on the go at any one time. With last years iPhone stats being around 9% the poopularity of the iPhone is only growning and it wont be long before its the dominant smartphone in my opinion, especially with the App Store only getting better. As much as I like Google, the Nexus One hasnt a chance against it.
Until next time;)
Later.
The next app I attempted was based around the idea of auto rotation. This is when the iPhone is turned on its side and the view changes from the tall and skinny portrait view, to the the short and wide landscape view. For the app I placed 6 buttons on the view numbered 1 to 6. Having done this I found some already existing code within the implementation file that had been provided by Apple but commented out. By uncommenting the existing code it basic allowed for the iPhone to be turned on its side the for the view to change accordingly. Extremely handy that its already there for you. The problem I faced then was that when the iPhone is rotated the six buttons don’t fit in landscape mode so the overlap and it all gets messy. To fix this the buttons “Autosize Attributes” need to be changed using the inspector in IB. It basically tells the button what position to occupy when the iPhone is rotated. Having given them new rotated positions I wrote some code which makes the buttons change size as well as change position when the view changes to landscape.
This app was fairly quick and straightforward, partly because some of the code needed is already written by Apple. The coding of changing the button size on rotation was a little tedious but a lot of it could be copied and pasted. Have a look at the pics to see the results
Until next time,
Later;)
As I stated in the last post, this app contained a variety of different controls. One of which is a slider. For this app when the sliders value changes, its value is shown in a label placed beside the slider. Outlets were created for the label and slider in the header file, and the IB Action was done it in the implementation file specifying that when the value of the slider changes the string property of the label corresponds to it. The next controls that were added were two switches. These are controls that have only two states, on and off. I also added a segmented control to show and hide these switches. This means putting a view around the two switches and having the segmented control have two states also, show and hide. Again outlets were created for each switch and linked to the files owner in IB. When the segment control. The final thing that I added was a pop up “Are you sure menu” thats known as an action sheet. It had an are you sure?, yes/no look to it. This was actually quite difficult to code and took me quite a while to get right.
This app definitely thought me a lot about the different controls available and how to code them efficiently. It also thought me just how much you can do with the iPhone SDK. The next app is one that takes advantage of the rotation capabilities of the iPhone.
Until next time,
Later ;)
The next app that I created was called Control Fun. It incorporated a lot of the main controls that you would see in general apps. This one took me a while due to the amount of coding, so I’ll break it up. The first control used was the textbox. Two of them to the specific. Outlets were again created in the header file and the @synthesize dirctives in the implementation file. After connecting the outlets in Interface Builder text can be entered in the simulator. What I also did was make one text box bring up the number keypad as a defaut. The difficult coding part to this was making the keyboard go away once finished typing. As you probably know it takes over half the screen when engaged. This was done by created an action that when anywhere on the screen is clicked the keyboard dissappears. Very clever really. In this app an image was also placed in the view. Very straight forward really once its the correct size.
The next controls added include a slider, a segmented control that contains two switches, and a show hide control. I’ll describe them in the next post
Until next time,
Later ;)
Seeing as it is the week of the Apple iPad release, I’ll wait til next week for the the iPhone app description. So the long awaited Apple tablet was finally released. I dont think theres ever been as much hype surrounding an Apple product release. Despite the fact everyone was so sure a tablet was on its way, nobody knew what to expect. Steve Jobs was quoted as saying its “the most important thing he has ever done”, just a few days before the release. And he didn’t dissapoint in my opinion. It’s awesome. Everything from the peek preview of the phtot gallery to the to the apparently very user friendly interface seems very well done, as per usual from Apple. And in a new twist from Apple it’s very reasonably priced. Jobs says it’s meant to fit in somewhere between the iPhone and a MacBook. Seeing as I have both already I cant really justift on any level really buying one. But you’ll definetly find one being shipped to my house when they’re released!! What can I say, I love my gadgets. Especially Apple ones.
Thu
Jan
21
So the second test app i tried out was called “Button Fun”, taken from the book I mentioned in my last post. It’s the first time I wrote some actual code so it was a good learning curve.
The project consisted of a view with two buttons, left and right, and a single label. The idea being that when one the the buttons was pressed the labels text changed. I started within the header file, Button_FunViewController.h and created an instance variable known as an Outlet called IBOutlet UILabel *myButton. Think of it as a pointer to an object. I also created an Action called -(IBAction)buttonPressed;(id)sender; with IB standing for Interface Builder. Still within the header file there’s a property declaration @property(retain, nonatomic) UILabel *statusText;
Moving to the implementation file, Button_FunViewController.m, the action behind what happens when the button is pressed is written. The label will show Left Button Pressed when the left button is pressed and the same for the right. This is done by creating a string that is activated when then button is pressed.
Next in interface builder the view was created with two buttons with their text changed to left and right and a single label with text left blank. The statusText outlet is then connected to the label and the buttonPressed action connected to each button through the Files Owner icon. Then build and run!! See the screenshots I’ve posted from it.
This app was very educational as it gave a good insight to the interaction thats needed between IB and XCode.
Until next time,
Later ;)