Skip to main content

Posts

javascript onclick combining 2 events does not work on ios (iPhone, iPad)

I'm combining 2 javascripts in the onclick to do 2 things: 1. Stop an audio player 2. Load and iframe that has a video The following code works on all browsers but not iOS (iPhone, iPad) <a class="aboutclick" href="#" onclick="stop2();document.getElementById('frame').innerHTML='&lt;iframe src=&quot;paul-on-paul.html&quot; width=&quot;100%&quot; height=&quot;600&quot; scrolling=&quot;no&quot; frameborder=&quot;no&quot;&gt;&lt;/iframe&gt;'"><img src="assets/video-cold.jpg" alt="paul-gregory-video" width="161" height="81" border="0" /></a> The stop2() in the beginning of the onclick code is what turns off the music player. (it's Flash audio player so it doesn't apply to iOS). Tapping on the image does nothing on the iPad, iPhone with this code present. If I remove stop2(); from the onclick c

Detecting Zoom Level on iPhone

I'm using the UIImagePickerController to control the camera and overlay millimeter tick marks in preview for measuring closeup macro shots, and I'd like to be able to detect the current zoom level and scale it properly. Is there any way to determine the current zoom level in camera preview?

Why is UIGroupTableViewBackgroundColor causing Xcode 4.2 to choke?

I'm using Xcode 4.2 on Mac OS X Lion 10.7.3 and for some reason, every time I set UIGroupTableViewBackgroundColor as the background color on my UIView, the compiler refuses to build my app. When I open the "newly corrupted" XIB as XML and remove the offending XML represenation of the background color, the app compiles. I am able to apply the background color in code, but doing so in Interface Builder fails miserably. Here's the code that chokes Xcode. Any clue why this is happening? <object class="NSColor" key="IBUIBackgroundColor"> <int key="NSColorSpace">10</int> <object class="NSImage" key="NSImage"> <int key="NSImageFlags">549453824</int> <string key="NSSize">{512, 1}</string> <array class="NSMutableArray" key="NSReps">

How to copy superclass properties to a subclass?

Let's say I have two Classes like so: Car { NSInteger wheels; NSInteger bumpers; } + (Car *)carWithData:(NSDictionary *)carData; Lexus : Car { GPS *navigation; } + (Lexus *)carWithData:(NSDictionary *)carData; carWithData: is a simple helper method that creates an instance of Car populated with variables from carData . Lexus' version would also set the navigation data. How would Lexus' carWithData look like without duplicating code from Car ?

Using Source Control with git and new projects

I'm new to SCM and I've managed to create and use a repository for an existing project. By following a variety of posts, I've done the following: 1) Created an account on Assembla 2) Used bash/git in my existing project directory to add, commit, and push the project 3) Used Source Control in XCode to pull, modify, commit, and push changes Now I want to start a new projection Xcode, and it seems I have to go through the same steps, using a mixture of Xcode 4.2 and bash commands to get the new project into Assembla. For example, I created a new space on Assembla "newjunk", started a new project in Xcode "newjunk" and did NOT check "create local git repository". I did not run any bash/git commands. In Xcode I cannot "push" because I did not "commit", and I can't "commit" because "no valid working copies were found". Is this the only way to get a new project into a remote repository? Or can

Convert image data to binary text for vcard

I need to include an image in a vcard file. The image is supposed to be in binary format. I create the image data as follows: NSData *imageData = UIImageJPEGRepresentation([UIImage imageNamed:@"Pic1"], 1.0); I have unsuccessfully tried encoding using the following 2 methods: vcardString = [vcardString stringByAppendingFormat:@"PHOTO;ENCODING=b;TYPE=JPEG:%@\n", [imageData base64EncodedString]]; AND vcardString = [vcardString stringByAppendingFormat:@"PHOTO;ENCODING=b;TYPE=JPEG:%@\n", [imageData description]]; Any advice on how to get the image data properly encoded to binary would be appreciated. Thanks

Memory Leak & App Crash when going back to Album List

I'm using three20 to create image viewer. First i'm creating list of albums from the sql db and when user selects any album, its url string is passed to the this code that creates thums of available pics on network using XML Parser. everything works fine but when user goes back to the album list and selects another album. app crashes with 'Thread 1: Program received singal: "EXC+BAD_ACCESS" in main.m . plus XCode Product Analyze gives potential memory leak where i'm creating photoSource in the viewDidLoad. Here is the code #import "AlbumController.h" #import "PhotoSource.h" #import "Photo.h" #import "AlbumInfo.h" #import "AlbumDatabase.h" @implementation AlbumController @synthesize albumName; @synthesize urlAddress; @synthesize images; - (void)viewDidLoad { [super viewDidLoad]; // NSLog(@"%@", self.urlAddress); [self createPhotos]; // method to set up the photos array self.photoSour