Showing posts with label iPhone. Show all posts
Showing posts with label iPhone. Show all posts

Pass parameters to web-service with image uploading in iphone

When you upload a file you are really posting a form's content to the browser by using a different encoding type (enctype) in your form. That encoding is specified as enctype="multipart/form-data" as an attribute of your form.
The specification in RFC 1867 "Form-based File Upload in HTML" describes the mechanism by which a file may be uploaded from a Web browser to the server.
There are a lot of articles to pass image to webservice. but, I require to pass some parameters with image.

Dynamic multiline label with custom font in UITableViewController

Suppose you need to show long text in tableview cell with custom font then height is the major issue. See following steps to do this:
1. Download FontLabel app source from
http://github.com/zynga/FontLabel
It has a good library with sample to use custom fonts embedded with project. Add FontLabel library to your project.

Show UIImagePickerController from UITableViewController in iPhone

Suppose you need to show UIImagePickerController on cell click of UITableViewController class. Then
1. define UIImagePickerControllerDelegate in the header class.
2. Put following code for the cell index of didSelectRowAtIndexPath method

Resize Image to scale for a given max dimension in iphone

Generally , It is required to resize image for a given max size. the ratio of the image width and height is called Aspect ratio. If resized image aspect ratio is different from original image then it is distorted. So, It is required to resize the image in such a way that it must be in the given max size keeping same aspect ratio.

Reload Table View with different values iPhone

Sometimes, It is required to use same tableviewcontroller multiple times with different parameters. For example, in a game, we need to show same screen with different elements. Here, our object is to reuse UITableViewController with different parameters and it will be happened on navigation next button click.
Here are the simple steps to do this:

Generate random order of series in iphone

Generally, it is required to show something in random order in series such a way that each item must be selected at one time. For example, In a Quiz application, you need to show all questions in random order and each question must be selected and not more than once. For this, use following method:

Pass username and password to webservice in iphone

There are different ways to pass username and password to connect webservice.
Username and password can be posted in the web service url itself to authenticate.
Suppose you have following information:
Webservice url: http://sitename.com
username: myusername
password: mypassword

Get tag value from XML string iphone

Sometimes, it is required to get value of tag from xml string which has limited tags.
suppose the xml string (say returnString) is
<success>1</success><title>Information</title><message>This is testing</message>
and we need to extract value of success, title and message tags.
See following method for this:

UIActivityIndicatorView for UITableViewController in iPhone

Generally, it is required to show activity indicator view during asynchronous/time consuming processes. For example, In webservice application, you have to wait a few seconds to make the request and get the response mean time UIActivityIndicatorView is displayed to indicate the processing is going on. Suppose you require showing UIActivityIndicatorView in UITableViewController. It might be on cell click or on loading. We need to disable the form controls on the form during activity and show activity indicator view.