" Live as if you were to die tomorrow. Learn as if you were to live forever.. "
- Mahatma Gandhi

How to make UIView with RoundRect Corner and border in iPhone/iPad App?

Posted on November 24th, 2015 by Waseem Ahmad

In iPhone application  development, when we are required to show UiView with round rect corners, we genrally use images with border or round rect corner in background view. However, we can also meet the requirement by using layer properties. Example 1. Round rect corner just we need to set corner radius property of view layer […]

How to implement vertical slider in iPhone/iPad?

Posted on November 24th, 2015 by Deepak Vashisht

 In iPhone/iPad UITextview shows slider on the right side of the display only when we tap on it. So the user is not able to know that the text is scrollable. For this reason clients sometimes demand that we use a vertical slider to show that the text is scrollable. One approach is to create a nib file […]

Embedding YouTube Videos in a Grid View in iPhone App.

Posted on November 24th, 2015 by Deepak Vashisht

In many projects, YouTube videos are embedded and there is a need to display these images in grid view. For displaying videos in grid view, we have to create another view for thumbnail view, create objects for this view and add it to the main view. However, I have a simpler and effective solution for this: Sample Project for […]

Showing and Hiding iAD Banner View in iPhone App

Posted on November 24th, 2015 by Deepak Vashisht

iAd Banner view is implemented to show advertisements in the iphone app.It is mostly placed at the top or at the bottom of the view of the app and it depends upon network connectivity to load the advertisement. Due to connection error ,it is sometimes not able to load the Ads as a result of which it is […]

Using jQuery Plugin to implement scrollbar in iPad,

Posted on November 24th, 2015 by Sandeep Agrawal

Since normal scrollbar implemented for browser does not work in iPad, we can implement it using JScollPane which is a jQuery plugin. The files can be downloded from the following links: JS files: (www.kelvinluck.com/assets/jquery/jScrollPane/scripts/)   jScrollPane.js(for scrolling) jquery.mousewheel.js(scrolling with mouse wheel) jquery-1.3.2.min.js(jquery plugin) CSS file: (www.kelvinluck.com/assets/jquery/jScrollPane/styles/) jScrollPane.css(for scroll images) Scroll Images: (www.kelvinluck.com/assets/jquery/jScrollPane/images/) windows_arrow_down.gif windows_arrow_up.gif windows_drag_bottom.gif windows_drag_middle.gif windows_drag_top.gif windows_track.gif […]

FQL, Permission , Facebook and iPhone

Posted on November 24th, 2015 by Deepak Vashisht

Permissions are required to perform a task. Suppose, we own a house having a number of rooms.No one will able to enter until they have key (Here key act as permission). And we can provide key of some rooms to other , so that they can do specific function in behalf of owner. So, for […]

Create alphabet list in UITableView in iPhone

Posted on November 24th, 2015 by Ratnesh Singh

With some simple changes we can easily create a list of alphabets in iPhone.   // Configure the cell. cell.textLabel.text = [NSString stringWithFormat:@”%c”,indexPath.row + 65] ; return cell; – (NSInteger) tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section { return 26; } We get the list of alphabets from A to Z in the table form.  

Create a Grid View In iPhone Application

Posted on November 24th, 2015 by Saurav Nagpal

Initialize a scroll view with content height equal to the number of rows you require in a grid view: if(_thumbCount > MaxPageCountOnScreen) _lastThumbIndex = MaxPageCountOnScreen else _lastThumbIndex = _thumbCount; NSUInteger numberOfRows = ceilf((float)_thumbCount / 3); NSUInteger scrollViewContentHeight = (rowHeight * numberOfRows) ; self.contentSize = CGSizeMake(self.frame.size.width, scrollViewContentHeight); Initialize a scroll view with content height equal to […]

How to read data from text file and search for a word in the file in iPhone

Posted on November 24th, 2015 by Deepti Gupta

The following code snippet demonstrates how to read data  as well as search for a word in a text file in iPhone   // get text file path from application bundle. _string_filePath = [[NSBundle mainBundle] pathForResource:@”fileName” ofType:@”txt”];  // get the contents of file. _string_myFileText = [NSString stringWithContentsOfFile:_string_filePathencoding:NSUTF8StringEncoding error:nil];  // pass the range of text within which the search has to be done. Here […]

Retina display issue with layer drawing in iOs

Posted on November 24th, 2015 by Waseem Ahmad

As most of us know 2x images are directly supported by iOs SDK for retina display, but it doesn’t support in case of layer. However, we have got this issue in one of the project where we are drawing image on a layer and images are showing blur.  The main reason behind this is that […]

How to return the keyboard when UITextField is a subview of UIAlertView in iPhone.

Posted on November 24th, 2015 by Deepti Gupta

Normally if we are working on UITextField and want to dismiss the keyboard on return key we implement : – (BOOL)textFieldShouldReturn:(UITextField *)textField { [textFieldresignFirstResponder]; returnYES; } But if our UITextField is a subView of UIAlertView then we first assign text field to become first responder and then check whether our textField is the first responder […]

To restore the previously done transactions in In-App purchase in iPhone.

Posted on November 24th, 2015 by Nidhi Gupta

Once the transaction has been done on your device, sometimes might so happen that your app gets deleted or removed then it needs to be re-installed on that device. In that case in order to show or highlight all the items that were already purchased , we are required to restore all the transactions. You can […]

How to reload table view data from custom table cell view in iPhone?

Posted on November 24th, 2015 by Deepti Gupta

Often we create a custom table cell view for our table view cells and if we are required to reload our table view from our custom table cell view’s method then we can do it using the following. syntax: UITableView *tableView = (UITableView *) self.superview; [tableView reloadData];

How to avoid slow scrolling while loading an image from server?

Posted on November 24th, 2015 by Deepti Gupta

here are number of ways to avoid lazy or slow scrolling while loading an image from server.One of the method is caching of image. We can maintain dictionary as a local cache. For the first time, the data will be read from the server and it gets stored into this dictionary. Every time from then […]

How to make cell height dependent on text length?

Posted on November 24th, 2015 by Waseem Ahmad

Generally, we use cell for displaying the text, sometimes text length may vary like in case of showing details. We face issue how to make cell height dependent on text length? here, I am writing small tip that will help you to determine height of cell depending on text length.   Step #1First fix the […]

How to find out the total accuracy of GPS signal on iPhone using geometric formula

Posted on November 24th, 2015 by Subrat Kheti

In order to get the current accuracy of the GPS signal, you need touse.location.horizontalAccuracy and.location.verticalAccuracy in the CLLocationManager. The number correspond to horizontal and vertical accuracy. In order to get the total accuracy, theseare combinedwith geometric formula as follows     float totalAccuracy= pow(pow(manager.location.horizontalAccuracy,2)+ pow(manager.location.verticalAccuracy,2) where manger is the object of CLLocationManager.

How to dynamically reset the width of UIPickerView in iPhone

Posted on November 24th, 2015 by Deepti Gupta

If we have to create multiple picker views in our UIView side by side then we would normally write the syntax for it as follows: UIPickerView* pickerView1 = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 95, 100, 216)]; and so on for the other pickerviews. Now here we are basically required to decrease the width of UIPickerView. But the […]

How to embed Vimeo videos in iPhone

Posted on November 24th, 2015 by Vishwanath Vallamkondi

For embedding vimeo videos into iphone we need a video url, like http://player.vimeo.com/video/17314292 Here 17314292, is a video id in the site. The embedded html code will be   <html> <head> <script type=”text/javascript”></script> </head> <body> <iframe src=”http://player.vimeo.com/video/17314292?title=0&byline=0&portrait=0″ width=”104″ height=”59″ frameborder=”0″> </iframe> </body> </html>     This html code can be loaded into web view by […]

Create hierarchy list in UITableView in iPhone.

Posted on November 24th, 2015 by Ratnesh Singh

  Draw the Table like this.   Create the new fileMyStaffCellView from Objective-C template derived fromUITableViewCell .   #import <UIKit/UIKit.h> @interface MyStaffCellView : UITableViewCell { Employee* _employee; } – (void) setScreenData:(Employee*)data; @end #import “Employee.h” #import “MyStaffCellView.h” @implementation MyStaffCellView – (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString*)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code } […]

How to crop image in iOs?

Posted on November 24th, 2015 by Waseem Ahmad

Some times you need to crop image in perticular size in your App. You can use this utility function for this purpose. + (UIImage*) cropImage:(UIImage*)inImage ofSize:(CGSize)inSize { if (inImage) { CGRect thumbRect = CGRectMake(0, 0, inSize.width, inSize.height); UIGraphicsBeginImageContext(inSize); [inImage drawInRect:thumbRect]; UIImage *thumbImage = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); return thumbImage; } else return nil; }  

How To Customize The Navigation Title In iPhone?

Posted on November 24th, 2015 by Deepti Gupta

If we have the requirement to customize our navigation bar’s title then we cannot change any feature of the navigation title. So to solve this problem we can simply create a UILabel as follows :- UILabel *titleLabel = (UILabel *)self.navigationItem.titleView; and then customize it according to our requirement and finally assign this titleLabel as follows […]

Customized method to get date from yyyymmdd hh:mm:ss.

Posted on November 24th, 2015 by Nidhi Gupta

  + (NSString*) formattedDateFromString:(NSString*)dateString { dateString = [[dateString componentsSeparatedByString:@” “] objectAtIndex:0]; NSDateFormatter *dateFormat = [[NSDateFormatteralloc] init]; [dateFormat setDateFormat:@”yyyy’-‘MM’-‘dd”]; NSDate *date = [dateFormat dateFromString:dateString]; // Change the locale as per requirement eg. English = en_US, swedish = sv_SE dateFormat.locale=[[[NSLocale alloc] initWithLocaleIdentifier:@”sv_SE”] autorelease]; dateFormat.dateStyle = NSDateFormatterMediumStyle; [dateFormat setDateFormat:@”MMM dd’,’ YYYY”]; dateString = [dateFormat stringFromDate:date]; [dateFormat release]; return […]

Adding inline image in your email

Posted on November 24th, 2015 by Kapil Kumar

In order to get an image into your email, you need to get a base64 encoder into your project. We can easily attached inline image to our email message by using the HTML string. For this, we need to add <img> tag with base64 image source. In order to get an image into email, we […]

IsCache to check NSDocumentDirectory FileSize and Disk Size Availability

Posted on November 24th, 2015 by Nidhi Gupta

We can do the caching on the basis of sizes in user-settings. Like user can select an option whether he want to do caching of data in sizes 1 MB, 100 MB, 500 MB, 1GB etc… We can make a check whether the current downloaded data be cached or not on the basis of user […]

Changing Application Icon for iPhone in Rhodes Application

Posted on November 24th, 2015 by Ashis Kumar

iPhone 4.0 onwards needs three size of icons. They are icon57.png ( 57×57), icon72.png ( 72×72 ) & icon114 ( 114×114 ). We need to put these icons into ‘icon’ folder present inside ‘app’ folder, while building the Application using RhoStudio. If you are building the Application using XCode, then you need to replace the […]

Support Orientation device in Landscape mode.

Posted on November 24th, 2015 by Ratnesh Singh

Support Orientation device  of  iPhone /  iPad in  Landscape mode   Step 1. Target -> Summary -> Suport orientation device -> Select –> LandScapeleft / landScape right Step 2. Goto .M file and override the function like – (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { return UIInterfaceOrientationIsLandscapeinterfaceOrientation); } With help of these two steps, we fixed the support orientation […]

Scroll to a specific position in UIScrollView

Posted on November 24th, 2015 by Deepti Gupta

Dragging the scroller to a specific location automatically when user scrolls through the scroll view the very first time. If we have the requirement of dragging the scoll automatically to a specific position when the user scrolls the first time then just  1. set the scroll view delegate  2. add its protocol and use the […]

Generating ICS file format

Posted on November 24th, 2015 by Tauheed Ahmad

I got the solution to generate the .ics file. To create any .ics file in your document directory or somewhere else then you need to pass the string to write the file. But must need to be in string format.�€�The real string format to write the file of .ics is:   BEGIN:VCALENDAR PRODID:-//Google Inc//Google Calendar […]

How To Set UIBarButtonItem Text Color Or Font

Posted on November 24th, 2015 by Rupesh Kumar

Here is a method in UIBarItem class, where you can send your custom text attributes into dictonary form.   – (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state // Set the text color or font of UIBarButtonItem [barButtonItemsetTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys: [UIColor redColor ], UITextAttributeTextColor,nil] forState:UIControlStateNormal];    

File downloading using titanium.

Posted on November 23rd, 2015 by Raju Mahato

Code to download files using our cross platform iPhone/Android app in Titanium is described below. Code Block : //Url of the file that need to be downloaded var downloadingFileUrl = “Url of the file that need to be downloaded” //File path where downloaded file will be saved var fileSavingPath = Titanium.Filesystem.getFile(Titanium.Filesystem.applicationDataDirectory,”file_Path”); //Define the http client […]

Adding Map view to an application IPhone.

Posted on November 23rd, 2015 by Lopamudra Joshi

Google Maps is the most common platform implementation and the one both Android and the iPhone platforms utilize. Here we will implement a mapView by providing lattitude and longitude of a particular region. Let us create a view  //create our mapview var mapview = Titanium.Map.createView({ top: 110, height: 350, mapType: Titanium.Map.STANDARD_TYPE, region: {latitude: 26.00, longitude:94.00, […]

Facebook integration on cross-platform mobile application

Posted on November 23rd, 2015 by Raju Mahato

Facebook integration on cross-platform mobile app using Titanium. The following code is tested with iPhone,iPod and Android. Let say we have a view. Onclick of that view a window will appear to make post on Facebook. Ti.Facebook.appid = ‘Your_Application_Id’; // We will get this ID, when we will regiter this app on facebook Ti.Facebook.permissions = […]

Use Images From The Device Gallery In A IPhone/Android Application Using Titanium

Posted on November 23rd, 2015 by Raju Mahato

Sometime we need to extract images from device gallery in our application. Process to accomplish this using titanium for iPhone/Android devices are described below. Let say we have a window with a button to open gallery from device. //Define the current window var myWin = Titanium.UI.currentWindow; //Define the button to activate camera var openGalleryBtn = […]

Continious image scale in and out in IPhone

Posted on November 23rd, 2015 by Raju Mahato

Continious image scale in and out in iPhone using animation with Titanium. Continiously we can do image scale in and out animation using titanium. Let say we have image and I want to scale up/down continiously. So here is the code to do that described below. Code Block : //Define the current window var myWin […]

Rotate image continiously in iPhone

Posted on November 23rd, 2015 by Raju Mahato

Rotate image continiously in iPhone apps using Titanium. Rotate an image continiously. Let say we have an image and I want to rotate it continiously. So here is the code to do that described below. Code Block : //Define the current window var myWin = Ti.UI.currentWindow; //Define the Image var myImg = Ti.UI.createImageView({ width : […]

Rotate an image for a specific angle in IPhone

Posted on November 23rd, 2015 by Raju Mahato

Rotate an image for a specific angle in iPhone app using Titanium. We can rotate any image for a specific angle using titanium. Let say we have an image and I need to rotate it to 180. So here is the code to do that described below. Code Block : //Define the current window var […]

How to Play Videos Continuously in IPhone

Posted on November 23rd, 2015 by Raju Mahato

Let say we have few video clips and we need to play them continiously with in our iPhone app. The code to play videos continiously are described below. Code Block : //Current window var myWin = Ti.UI.currentWindow; //Lets we have three clips named “clip1.mp4, clip2.mp4, clip3.mp4” inside a directory and we will play them continiously. […]

Moving to current one after closing the previous window in android

Posted on November 23rd, 2015 by Raju Mahato

Sometime we need to perform some job while opening a new window in our application. For the time lets say we will show an alert message informing which page we are moving. The code to do so is described below. Code Block : //Define the current window var employeeWin= Ti.UI.currentWindow; //Define a button var changeWinBtn […]

Removing autofocus from textBox and auto keyboard pop-up on page load

Posted on November 23rd, 2015 by Lopamudra Joshi

While window load text box in Android automatically gets focussed as a result the Android Soft Key Board Pops Up. To Remove this automatic Popping Up of key Board use the following Code. Note : Text Field is mentioned as Pg.searchBar where the Window name is Pg.win Pg.win = Titanium.UI.currentWindow; //searchBar creation Pg.titleText = Ti.UI.createTextField({ […]

Check internet connection on device using Titanium

Posted on November 23rd, 2015 by Raju Mahato

Some applications require active internet connection to run on our smart devices. So here is a simple way to check connectivity and its status using Titanium described below with an example. Code Block : //Define the current window var currentWin = Ti.UI.currentWindow; //Define a Button var getDetailsBtn = Ti.UI.createButton({ width : 100 //width of the […]

Play Sound File in Cross Platform Application Using Titanium

Posted on November 23rd, 2015 by Raju Mahato

At times there are requirements in an application where we need to play sound with some action in background. There is a way to do that in cross platform application using Titanium, the following block of code accomplishes it. //Define current window Var currentWin = Ti.UI.currentWindow; //Define a button var playSoundBtn = Ti.UI.createButton({ width : 100, […]

Creating Navigation Group in iPhone using Titanium

Posted on November 23rd, 2015 by Lopamudra Joshi

Navigation group is used to navigate between two or more pages in iPhone in an animated / sliding way. The API provides with a back button which can be used to go back to the previous view. For a navigation group to exist there should be at least a root level window that would act […]

Custom Control In Navigation Group

Posted on November 23rd, 2015 by Lopamudra Joshi `

This tip demonstrates how to add custom controls to a navigation group and change navigation group color/image. For changing color barColor property of a window is set to a color and for changing/ assigning an image to navigation group the barImage property is used. In the following snippet a root window created, in which one navigation […]