Custom controls can be edited live on interface builder with the help of IBInspectable and IBDesignable
Tuesday, July 15, 2014
Xcode 5.1 or xcode 6 to start new project, in short iOS7 vs iOS 8
Custom controls can be edited live on interface builder with the help of IBInspectable and IBDesignable
Friday, November 2, 2012
Curl view animation using UInavigation controller
Function to go on next view :
Tuesday, July 31, 2012
Scroll to top of UITableView by tapping status bar
This is really a small thing but very important if you see by the perspective of good UI. Just like an apple native apps when you tap on status bar it will load zero'th index of tableview or we can say scroll to top.
It's just a sing line of code :
TableViewObj.sc
Happy Coding :)
Monday, July 9, 2012
iPhone vs Android Phones
Just to help my all job seeker friends i am writing this blog post.
iOS is developed by apple, and is a closed source mobile offshoot, based on the Mac operating system, optimized for a mobile device
Android is an open source Linux based operating system developed by Google, optimized for mobile devices
2) Security
iPhone has More security. You can blindly rely on iPhone for your data security and other factors.
Android has less security than iPhone
3) User Control
iPhone has better user interface and UI is really easy to use.
Android UI is also good but not that much appealing
4) Vendor Lock-in
iPhone comes up with vendor lockin like AT&T or verizon. Now a days they are allowing unlocked phone but cost is too high.
You can use android phone with any carriers.(ie Open to carriers)
5) Battery Life
iPhone is having better battery life but battery is not replaceable.
Now a days few android phones are also having good battery life but not that much of iPhone but you can replace battery.
6) Memory
iPhone comes up with inbuilt memory device. (8GB,16GB,32GB,64GB)
In android phone mostly we use SD-cards which is main root cause to data leakage and virus infection.
7) Google Integration
iPhone is having limited Google integration. In ios6 they have moves Google Maps too.
Android is having all Google product integrated in phone right from Google maps to Google voice.
8) Hardware support
Apple controls all of its hardware, and it is therefore simple to perform the necessary accessory maintenance.
Google’s Android is simply a platform that functions on different platforms, and doesn’t allow for easy accessory support.
9) Cost
iPhone is more expensive than other smartphones in the market except you are purchasing it on contract.
In Android phone you are having lot of varieties available in different price range.
10) Phone Screen Size and Quality
The iPhone 4S has the superior display right now in terms of detail and brightness.
Android phone just come up with a larger screen but not that much quality.
11) Device Camera
The iPhone 4S has the best camera we’ve used yet.
Android phones camera is not that much effective but give you more control of your images—before and after the shot.
12) Developer support
Apple having really state-of-art development tools with proper documentation which will ease life of apple developer. Only thing is that they are having limited access to the resources or we can say device.
Tools available for android is also good but not that much appealing when we compare it with Apple tools.
13) App Market Policy
Apple is having very strict app approval policy, many time it will take a week or two to review and approve the App on app-store which will maintain quality of app.
Google market approval process is not that much strict and app will get approved within 2-3 days.
If you guys want to add more into this please add it in comment.
Thursday, June 21, 2012
Pass Type IDs in iOS 6
The only information shared by apple is :
Passes are a digital representation of information that let users take an action in the physical world, in the same way as boarding passes, membership cards, and coupons. Pass Type IDs define a class or category of passes you wish to offer.
You must register your Pass Type identifiers in order to generate Pass Certificates which are used to digitally sign and send updates to your passes.
I have updated our iPhone to ios6 beta and one more app is new there called "Passbook" where you can save your passes and coupons, etc.
I found some good article where you come to know about passbook programming :
http://www.futurechips.org/thoughts-on-latest-happenings/generating-passes-ios6s-passbook.html
Following is the repository where you can found a PHP code to create passes on the fly.
https://github.com/tschoffelen/PHP-PKPass
Saturday, June 16, 2012
How to make your iOS app UI appealing? Part 1
In other case app like Foursquare, Path, Google places , Quora, pintrest and many others are also presenting Neat and clean UI. The reason behind this is user will get attracted more toward UI not toward functionality. Functionality is the part which is important from developer point of view but user want something different everytime.
In my iOS career i have also developed some good UI appealing app and now want to share some key element which need to taken care of while designing app like this.
1) While starting for any app first clear its requirement, and try to draw that requirement in terms of wireframe by using software like Balsamiq and other. which will give you more clear app development idea and also your client knows that what he will be getting after few months.
2) Try to use .xib rather than using Programmatic way to add controls on view.
3) Check with your graphics designer that he is designing images for you in Retina display size. and also confirms what dpi he is using for rendering this images.
For iPhone and iPod touch launch images, include the status bar region. Create launch images of these sizes:
- 320 x 480 pixels
- 640 x 960 pixels (Retina Display) - 180 ppi
- For portrait:
- 768 x 1004 pixels
- 1536 x 2008 pixels (Retina Display) -252ppi
- For landscape:
- 1024 x 748 pixels
- 2048 x 1496 pixels (Retina Display) - 252 ppi
4) Before starting designing exact view controllers first decide the button size that you want to use in your application. keep the button or other control ratio same on every view of your application so that user will get feel of navigating in same app.
5) Try to use default controls provided by apple if you don't have graphics for application.
6) Try to use custom controls if you have really clean and neat graphics available.
7) Try to concentrate on one factor where all developer will get confuse i.e. Auto resizing views, which will help you to place controls at some specific location.
8) Whenever you are trying to deal with large number of sequential data coming from server try to use UITableview to represent it. UITableview is having lot of customization methods which will help you to design good UI.
9) Avoid excessive use of UIScrollview in your application which will increase user confusion.
10) Try to reduce number of activity indicator in your application which will lead bad user experience.
In next post i will try to explain on particular custom controls which will used by all popular apps along with these tips.
Keep Coding..
Thursday, October 20, 2011
Swipe to delete from UITable view
#pragma for deleting element from tableview
-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if(editingStyle == UITableViewCellEditingStyleDelete) {
[Array2 removeObjectAtIndex:indexPath.row];
[Array1 removeObjectAtIndex:indexPath.row];
[TableName_obj reloadData];
}
}
Saturday, June 11, 2011
Generate MD5 Hash of a string in iphone sdk
Include following class your project :
md5.h
+ (NSString *)getMD5FromString:(NSString *)source;
md5.m
+ (NSString *)getMD5FromString:(NSString *)source{
const char *src = 1;
unsigned char result[CC_MD5_DIGEST_LENGTH];
CC_MD5(src, strlen(src), result);
NSString *ret = [[[NSString alloc] initWithFormat:@"%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
] autorelease];
return [ret lowercaseString];
}
Tuesday, May 31, 2011
Interview question part 3
- Basic Questions:
- identify basic OO concepts and the keywords Objective-C uses (interface, implementation, property, protocol, etc)
- what is a designated initializer, what is the pattern for the initializers and why ( if (self = [super ...] ) )
- basic memory management topics, like ownership retain/release/autorelease
- what happens if you add your just created object to a mutable array, and you release your object
- what happens if the array is released
- what happens if you remove the object from the array, and you try to use it
- trick: garbage collection on iPhone
- autorelease pool usage
- property declarations ( assign, nonatomic, readonly, retain, copy )
- trick: ask about the nonexistent atomic keyword, what does atomic mean
- ask on how to correctly implement a retaining setter property
- ask about the circular reference problem and delegates being usually saved with assign rather then retain
- what is the difference between the dot notation and using the square brackets
- what happens when we invoke a method on a nil pointer
- difference between nil and Nil
- what is KVO and related theory + methods to use when observing
- does KVO work with ivars too?
- protocols – maybe: main difference between c#/java interface and protocols
- what to do in a situation when a class doesn’t implement a method from a protocol
- what about multiple class inheritance
- what is fast enumeration
- class methods vs instance methods
- visibility of methods
- what is an actual class in Objective-c (struct)
- ask about the isa member
- ask about isKindOfClass isMemberOfClass
- root classes: NSObject, NSProxy
- how does proxy-ing work
- how to fake multiple class inheritance
- id type
- what happens during compilation if we invoke a method on an variable with the type id
- what happens runtime if the method exists
- what happens if the methods doesn’t exist
- pro and cons of using the type id
- what happens here(compile + runtime): NSString *s = [NSNumber numberWithInt:3]; int i = [s intValue];
- what are class categories and the () category
- what is an informal protocol
- what is a delegate, how to create one, and use one
- what is a selector, how to do a perform selector
- how to delay executing a selector
- what to do when the selector has more paramters (NSInvocation>
- how to start a selector on a background thread
- how to start a thread
- what is the first thing to do on a thread (autorelease pool)
- what is a runloop, and one very common place where it is used (timers, nsurlconnection)
- how to download something from the internet
- what is the difference between a synchronous and an asynchronous request
- small task: explain how to download an image from the internet, and show this in an image view – all this after a button is tapped on the view
- what are notifications, how to use them
- what is a memory warning, how do we respond to it
- when to use retainCount (never, and why)
- why shouldn’t we invoke instance methods in an initializer and the dealloc
- NSCoding, archiving
- NSCopying, why can’t we simply use our own objects as key in a dictionary, what to do to solve the problem ( and the difference between a shallow and a deep copy)
- what is a view, and a window
- difference between a view’s bounds and frame
- what is the resolution of the current available devices, difference between points and pixels (starting with iOS4)
- what is the responder chain, becomeFirstResponder
- what do IBOutlet and IBAction mean, what are they preprocessed to
- how do tableviews function
- what about multithreading and UIKit
- what to do when the keyboard appears and hides some parts of the UI that are important
- why should we release the outlets in viewDidUnload
- what is awakeFromNib, what is the difference between a nib and a xib
- what is a context
- what about multi threading and core data usage
- what is an NSManagedObjectId – can we save it for later if the application was stopped
- what types of stores does core data support
- what is lazy loading, how does this relate to core data, situations when this can be handy
- how to ready only a few attributes of an entity
- what is an fetch result controller
- how to synchronize contexts
- how could one simulate an NSManagedObject (i’m thinking of the fact that all the properties are dynamic and not synthesized)
Friday, May 20, 2011
Simple bluetooth chat application for iPhone
By using this framework you can ON bluetooth of your iPhone manually, but still there is no chance to OFF the bluetooth manually.
I had attached sample code of this application..its very simple to understand.
Steps to test a code:
Once the application is deployed to the two devices, launch the application on both devices. On each device, tap the Connect button. The GKPeerPickerController will display the standard UI to discover other devices .
After a while, both application should be able to find each other. When you tap on the name of the found device, the application will attempt to connect to it.
When another device tries to connect to you, you will see the popup. Tap on Accept to connect and Decline to decline the connection.
If you are connected, you can now enter some text and start sending to the other device. Data received from another device will be shown in an alert view .
And finally here you will get SOURCE CODE for this tutorial..
Thursday, January 27, 2011
Generating the Apple Push Notification SSL certificate on Mac:
1. Log in to the iPhone Developer Connection Portal and click App IDs
2. Ensure you have created an App ID without a wildcard. Wildcard IDs cannot use the push notification service. For example, our iPhone application ID looks something like AB123346CD.com.product.yoursiphone
3. Click Configure next to your App ID and then click the button to generate a Push Notification certificate. A wizard will appear guiding you through the steps to generate a signing authority and then upload it to the portal, then download the newly generated certificate. This step is also covered in the Apple documentation.
4. Import your aps_developer_identity.cer into your Keychain by double clicking the .cer file.
5. Launch Keychain Assistant from your local Mac and from the login keychain, filter by the
Certificates category. You will see an expandable option called “Apple Development Push Services”
6. Expand this option then right click on “Apple Development Push Services” > Export “Apple Development Push Services ID123″. Save this as apns-dev-cert.p12 file somewhere you can access it.
7. Do the same again for the “Private Key” that was revealed when you expanded “Apple Development Push Services” ensuring you save it as apns-dev-key.p12 file.
8. These files now need to be converted to the PEM format by executing this command from the terminal: openssl pkcs12 -clcerts -nokeys -out apns-dev-cert.pem -in apns-dev-cert.p12
9. openssl pkcs12 -nocerts -out apns-dev-key.pem -in apns-dev-key.p12
10. If you wish to remove the passphrase, either do not set one when exporting/converting or execute: openssl rsa -in apns-dev-key.pem -out apns-dev-key-noenc.pem
11. Finally, you need to combine the key and cert files into a apns-dev.pem file we will use when connecting to APNS: cat apns-dev-cert.pem apns-dev-key-noenc.pem > apns-dev.pem
Please check with ios5, as i am not that much updated with push notification implementation in ios5.
Wednesday, January 19, 2011
Augmented reality (AR)
Guys this week i had started with one new concept of Augmented reality (AR).I search lot for this concept but nothing is there on internet and still i am working to prepare demo on this.
Following is something about this big concept:
Augmented reality (AR) is a term for a live direct or indirect view of a physical, real-world environment whose elements are augmented by computer-generated sensory input,such as sound or graphics. It is related to a more general concept called mediated reality, in which a view of reality is modified (possibly even diminished rather than augmented) by a computer. As a result, the technology functions by enhancing one’s current perception of reality. By contrast, virtual reality replaces the real-world with a simulated one.
http://www.youtube.com/watch?v=DpmAyen4sv0
Very soon i will be here with one fantastic demo code on this.
Friday, October 15, 2010
Display Image in Imageview from any remote url
here
musicImage is a string which contain url.
and musicThumbnail is a imageview.
NSURL *imageURL = [NSURL URLWithString:musicImage];
NSData *data = [NSData dataWithContentsOfURL:imageURL];
UIImage *image = [[UIImage alloc] initWithData:data];
[musicThumbnail setImage:image];
Sunday, September 26, 2010
Use blutooth device for your own app
Last days i got lot of appreciation about my blog from students of spymek..thanks to all and thanks to ravi sir.
This time i am focusing on new concept to connect blutooth device to your own apps. I think you all poeple knows that whnever we connect any bluetooth device to our iphone or ipad it will work for all native application only..but if we want to use it for our own apps we have to connect it we have ti implement BTstack for that.
The code is available on google code.lets have a look at what google says about it.
""The aim of this project is to support devices for which the OS either does not provide a Bluetooth Stack or the available stack is severely limited (e.g., on the iPhone).
It provides a portable Bluetooth Stack that runs as a user-space daemon and will support different Bluetooth HCI transport layers (e.g., HCI H4 UART and H5 the "Tree-Wire" protocol), different inter-process communication methods, and support multiple applications in parallel.
It is not a port of an existing Bluetooth Stack. However, best practices from the Bluetooth Stack used in the BTnode Project at ETH Zurich and others are incorporated. ""
Lets look at this video :http://www.youtube.com/watch?v=WFWjVkzJb_s
You can found all your code on this link..http://code.google.com/p/btstack/
Waiting for your valuable commments.
Sunday, August 29, 2010
Working with core telephony framwork

Hi,
from last two days i am working on core Telephony framwork...1st of all i tried with iphone 3gs and i found that there is only 3 methods available..as follows
- (void)applicationWillResignActive:(UIApplication *)application
- (void)applicationDidBecomeActive:(UIApplication *)application
- (void)applicationWillTerminate:(UIApplication *)application
In applicationWillResignActive we can identify incoming call while we working on any application but the thing is that here it will take any inturrupt as a input.for e.g. if we are working on any application and if call comes it will detect it and we can set any pop-up on that but this fails when you set any alarm and if it activate in beetween this it will also generate interupt and also allow pop-up that u defined for detecting incoming calls.
Till iphone 3gs its totally useless to work on this method..here apple is not providing any methods to work on telephone and neither permit to do it by using any external methods.
All the blog publish by erica and others available only shows this three methods but if you have documentation of iphone os4.0 then you found core telephony framwork to work on this.
we have following methods in core telephony framework which with you can work.
You have to include these headers file in your code
1)CTCall.h
in these you found following methods
a)callID property
A unique identifier for the cellular call. (read-only)
b)callState property
The state of the cellular call. (read-only)
2)CTCallCenter.h
a)callEventHandler property
Dispatched when a call changes state.
b)currentCalls property
An array representing the cellular calls in progress. (read-only)
3)CTCarrier.h
a)allowsVOIP property
Indicates if the carrier allows VoIP calls to be made on its network. (read-only)
b)carrierName property
The name of the user’s home cellular service provider. (read-only)
c)isoCountryCode property
The ISO country code for the user’s cellular service provider. (read-only)
d)mobileCountryCode property
The mobile country code (MCC) for the user’s cellular service provider. (read-only)
e)mobileNetworkCode property
The mobile network code (MNC) for the user’s cellular service provider. (read-only)
4)CTTelephonyNetworkInfo.h
a)subscriberCellularProvider property
Information about the user’s cellular service provider. (read-only)
b)subscriberCellularProviderDidUpdateNotifier property
Dispatched when the user’s cellular service provider information changes.
You will find all the details of this methods on developer.apple.com.
--- This blog was written long time back and source code that i have is not compatible with latest SDK, Please do not send request for source code. I know its sound rude but please.:)--
Hope this information is usefull for you people...Happy blogging..
Thursday, August 12, 2010
Interview questions part 2
guys,
toady i had face a interview for the post of iPhone developer...following question were asked while interviewing me.
1) What is delegate?
2)what is the use of @synthesize?
3)what is retain and release?
4)what is the differance beetween pass by value and pass by reference?
5)Few question on my iphone project..
6)What is navigation controller?
7)getter and setter method?
8)what is @synchronize?
9)what is free and alloc?
ask some example on this.
10)what is deep copy and shallow copy?
11)function of section,row and row at index?
12)what will be output if section=2 and row=4?
13)how to run audio and video in iphone?which framework is used for this?
14)function overloading and overriding?
15)what is class?difference beetween class and structure?
16)Write a program, if u have two classes A and B. A contain some class and instance method and you have to invoke this method in B.
Do it without using inheritance?
17)How many touches events are there? explain it?
18)[class obj]
[obj retain]
[obj retain]
[obj release]
dealloc
{
}
what is the retain count?
and when dealloc will be called?
and finally i cracked this interview and got selected.
BEST luck
Saturday, August 7, 2010
Iphone interview question part 1
What is iPhone?
- IPhone is a combination of internet and multimedia enabled smart phone developed by Apple Inc.
- iPhone functions as a camera phone, including text messaging, and visual voice mail
- iPhone is a portable media player that resembles a video iPod
- It has user interface that is built around the multi-touch screen including virtual keyboard.
- App Store , which launched in the mid 2008 has over 1,00,000 applications with functionalities including games, references, GPS navigation, advertising, television shows, films, reference, celebrities.
v What are the features of iphone 3gs?
Video: Videos can be edited, shared. High quality VGA video can be shot in portrait or landscape.
3 Megapixel Camera: Still photos with greater quality can be taken
Voice control: It recognizes the names in contacts and recognizes the music on iPod.
Compass: iPhone 3GS has built-in digital compass, used to point the way.
Internet Tethering: Internet surfing can be done from anywhere. A 3G connection can be shared on Iphon3 with Mac notebook or laptop..
v What is iphone OS?
iPhone OS runs on iPhone and iPod touch devices.
Hardware devices are managed by iPhone OS and provides the technologies needed for implementing native applications on the phone.
The OS ships with several system applications such as Mail, Safari, Phone, which provide standard services to the user.
v What is iphone sdk?
iPhone SDK is available with tools and interfaces needed for developing, installing and running custom native applications.
Native applications are built using the iPhone OS’s system frameworks and Objective-C language and run directly on iPhone OS.
Native applications are installed physically on a device and can run in presence or absence of network connection.
v What is iphone architecture?
It is similar to MacOS X architecture
It acts as an intermediary between the iPhone and iPod hardware an the appearing applications on the screen
The user created applications never interact directly with the appropriate drivers, which protects the user applications from changes to the hardware.
v What is iphone reference library?
iPhone reference library is a set of reference documents for iPhone OS .
It can be downloaded by subscribing to the iPhone OS Library doc set.
Select Help>Documentation from Xcode, and click the subscribe button next to the iPhone OS Library doc set, which appears in the left column.
v What are sensors in iphone?
The proximity sensor immediately turns off the display when the iPhone is lifted to ear. With this sensor the power is saved and accidental dialing is prevented.
The display is automatically brightens the iPhone by the ambient light sensor when the sunlight or bright rooms and dims in darker places.
v What are the location services?
Applications such as Maps, camera and compass are allowed to use the information from cellular, Wi-Fi and Global Positioning System networks for determining the approximate locations.
The location is displayed on the screen, using a blue marker.
v Describe the functionality of accelerometer of an iphone
iPhone responds to motion using a built-in accelerometer.
The accelerometer detects the movement and changes the display accordingly, at the time of rotating iPhone from portrait to landscape.
v Explain about the applications that can be used with iphone
Technology, Entertainment and Design(TED): Allows to watch and listen to world’s most fascinating people have to say, all on the iPhone.
Market Watch: Breaking news about the investments can be seen. To do so, open the Stocks app and rotate.
Trends: Latest runway shows, videos from Vogue’s fashion library, reviews, exclusive party pictures, fashion news updates can be seen on Style.com
about my blog
All
Here i am posting some interview questions and facts about iphone that will be necessary while preparing for any iphone developer for interview...The credit of this blog goes to all those website from which i had copied this stuff..my intention behind this is only to avail all stuff at one location..If You have Any data regarding this send it to me or keep posting it in comment section..
expecting great response in future..
Thanks
sparsh