Updates from April, 2012 Toggle Comment Threads | Keyboard Shortcuts

  • danielsaidi 8:28 pm on April 16, 2012 Permalink | Reply
    Tags: , xcode   

    Adding older iOS simulators to Xcode 

    When developing my latest app, I have a device and a simulator that runs iOS 4.1. However, I have to be able to test it on older iOS versions.

    Luckily, you can install more iOS simulators. In Xcode, just choose

    Xcode > Preferences > Downloads

    Here, you can install more simulators, debuggers etc.

    Xcode > Preferences > Downloads

    So, as you can see…I am off to multi-simulator heaven!

     
  • danielsaidi 9:03 pm on March 13, 2012 Permalink | Reply
    Tags: , , photo library   

    Adding photos to the iPhone simulator 

    I am currently developing an iPhone app that will make use of the camera. Since I am also testing it in the simulator, I want to be able to select pictures from the photo library as well, if the camera is missing.

    However, once I open up the UIImagePickerControllerSourceTypePhotoLibrary in the iPhone simulator, I am presented with the following screen:

     

    No Photos iPhone screen

    No Photos – You can sync photos and videos onto your iPhone using iTunes.

     

    Uhm, can I (sync photos and videos to the simulator using iTunes)? I have not found a way, but there is an easy way to work around this and fill your iPhone with photos.

    Just open up Finder and drag any image you want to add to your simulator. When you see the green plus icon, just release the image and it will open up in Safari, like this:

     

    Safari browser screenshot

    The Safari browser shows the image that was dragged to the simulator.

     

    Now, click the image and keep the mouse button pressed, and you will get the option to save it to the simulator:

     

    Save option

    Press and hold the left mouse button to open the save and copy action sheet

     

    That’s it! If you open up the photo library, you will see the image in your list of saved images:

     

    Photo library

    The photo is added to the photo library

     

    Hope it helps!

     
  • danielsaidi 7:49 pm on February 29, 2012 Permalink | Reply
    Tags: gloss, icon, remove, shine   

    Remove gloss effect for iOS app icon 

    There is a really easy alternativ to this approach. The property list approach still work, but if you select the project root (the topmost one with the blue icon in the project navigator) and select the “Summary” tab, the iPhone and iPad icons can be set. Check the “Prerendered” box to disable the automatic glow effect.

    After a long time away, I started looking at iOS development once again…great fun.

    However, less fun and really unintuitive is how you remove the “gloss” effect for your application icon.

    This is how you do it:

    • Right-click your application Info.plist file.
    • Select “Open As / Source Code”
    • Add the following two lines anywhere (I add them after <key>CFBundleIconFiles</key><array/>):
    <key>UIPrerenderedIcon</key>
    <true>
    

    Voilá – you’re done!

    This must be one of the most hidden features I have ever come across. Does anyone know another way to do this?

     
    • zubii 5:57 am on January 28, 2013 Permalink | Reply

      Help! I did exactly as you did but when I tried to open it as a property list again it said “The data couldn’t be read because it has been corrupted”. It also wouldn’t build to run on the iOS Simulator. Am I doing something wrong?

      • danielsaidi 6:33 am on January 28, 2013 Permalink | Reply

        Oh, now there is actually a really easy way of doing this. The property list approach still work, but if you select the project root (the topmost one with the blue icon in the project navigator) and select the “Summary” tab, the iPhone and iPad icons can be set. Check the “Prerendered” box to disable the automatic glow effect.

        As for the corrupt warning, you probably entered some invalid piece of xml. If you right-click the file and select “Open as > Property List” this will probably not work as well, because the file contains invalid xml. Can you undo your changes? If so, undo and disable the glow effect as I described above. If now, remove everything you manually added so that the file is as it was back when it worked.

        Good luck.

    • zubii 6:55 am on January 28, 2013 Permalink | Reply

      Thanks so much, it worked. Yes, I was able to erase the changes, thanks. Thanks again.

  • danielsaidi 4:05 pm on February 4, 2010 Permalink | Reply
    Tags: shared libraries   

    Using shared libraries in iOS 

    After a couple of evenings, my first (really simple) iPhone app is taking shape. However, since I have my heart in .NET development, it is painfully clear how Microsoft has spoiled us with fantastic Visual Studio features.

    Some things that are natural and so easy to accomplish in .NET does not come so natural with iOS. One example is to gather reusable functionality in shared libraries. With the iPhone, it is not as easy-going as when developing in .NET.

    I have found several blog entries that describe how to accomplish this. One good example is:

    http://www.clintharris.net/2009/iphone-app-shared-libraries/

    In time, this will hopefully be made a lot easier even for iOS.

     
  • danielsaidi 11:53 pm on February 1, 2010 Permalink | Reply
    Tags: nsuserdefaults, retrieve   

    Save data in iOS without using a database 

    I have now created my firs iOS app UI – a nice tab bar that toggles between four different views.

    I now want to store a string that I have entered in a text field, so that the application remembers it the next time I start the application. For this small piece of data, I do not want to go through the hassle of using a database.

    This great tutorial describes exactly how this is done:

    http://icodeblog.com/2008/10/03/iphone-programming-tutorial-savingretrieving-data-using-nsuserdefaults/

    NSUserDefaults is ideal for saving small amounts of data. Check it out.

     
  • danielsaidi 6:54 pm on February 1, 2010 Permalink | Reply
    Tags: , interface builder, striped background, view   

    Set striped background in iOS 3.1 

    I’ve finally begun looking into iOS development on my spare time. It’s good fun and I will write about my experiences here, as my work progresses.

    I first started to play around with this good tutorial. After completing it, I thought I’d just replace the plain white background with the striped background that is so common in iPhone apps.

    Beautiful, striped background

    Beautiful, striped background

    However, no matter where I looked in Interface Builder, I could not find a way to set this striped background. Sure, you could insert a table view, set its style to Grouped and let it fill the window…but I want the view itself to have the background.

    After searching around, I found that many developers set the striped background with either an image (which I will not cover since I do not want to use images when not absolutely necessary) or programatically.

    Option 1 – set the striped background programatically (“bad”)

    It is really simple to set the striped background programatically. Just do the following:

       //If you have a controller with the view, do this
       theController.view.backgroundColor = [UIColor groupTableViewBackgroundColor];
    
       //If you have the view directly, do this
       theView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    

    However, is this as good as it gets? This way of setting the background means that the stripes will only show when you run the application and not if you open the view in Interface Builder…and that just don’t do it for me 🙂

    Thus, I mark this option as a “bad” way of setting the default background. Naturally, you may want to change the background programatically for various reasons, but maybe not the default background.

    Option 2 – set the striped background in the .xib file (“good”)

    Well, I did not find a way to set the striped background in Interface Builder (if you do know how, please leave a comment), but it is really easy to set it by modifying the .xib file in a text editor.

    To do so, just right click the .xib file you want to modify and select “Open As > Plain Text File”. Then, in the text editor, search for the following tag:

    
    

    For a plain, white view, the section should look something like this:

       
          1
          MC45ODQ3MTEyMDQ3IDAuOTg4NTMzNDAzNSAxAA
    

    Now, just add the following line as a sub tag to the object tag

       <string key="IBUIColorCocoaTouchKeyPath">groupTableViewBackgroundColor</string>

    so that the complete section looks something like this:

       
          1
          MC45ODQ3MTEyMDQ3IDAuOTg4NTMzNDAzNSAxAA
          groupTableViewBackgroundColor
    

    That’s it – if you open the view in Interface Builder, you will now have a beauuutiful striped background.

     
    • Badisi 4:08 pm on May 31, 2010 Permalink | Reply

      In Interface Builder :
      – Click on the background property of your view,
      – Click on the third tab of the colors window,
      – In the palette drop down list choose : iphone SDK,
      – And finally : groupTableViewBackgroundColor

      Hope it helps

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel