- What is the difference between underscore and self (i.e self
xx and _xx). ? - What is property?
- What is the difference between weak and strong?
- What is Retain Cycle? And how we can avoid it?
- What does copy means while declaring a property?
- What is
and when we need to use it?synthesize - What is a category?
- What is an extension?
- How we can add a property in a category?
- What is method
and when we should use it?swizzling - How we can
layout in a view?subviews - What are the size classes?
- What is ARC?
- What is @autorelease and when we should use it?
- How to animate view with constraint?
- What
core data?is - What
?is core data stack - What is managed object context?
- How we can do
with core data?multithreading - How to transfer
object from one thread to another thread?manage - How to merge changes from one
to another?moc - Difference between bounds and frame?
- What does dispatch_once do?
- What is
?delegate - How we can do
in iOS?multithreading - When you will use NSOperations over GCDs and vice versa?
- What does
do?alloc - How we can create a class in objective c which don’t inherit from NSObject?
- What are the different application states in iOS?
- How we can execute some code when app is in
?background - How we can wait for some thread to finish before starting another?
- How you will store user info (username, password or token) securely in iOS?
Mobile App Development
Here, I and you learn new things about latest mobile app development technologies. I share my knowledge about iOS and Android application development. Also, exploring the Swift, Objective-C and Kotlin language with latest version.
Saturday 19 March 2016
iOS interview questions
Saturday 23 July 2011
How to set rounded corner border of UIImageview
Steps to implements :
1] First add "Quardcore" framework and import it.
2] In view did load method write following code snippet
imgview . layer. borderwidth=5. 0;imgview . layer. cornerradios=10. 0;
Tuesday 21 June 2011
Soap webservice integration with iOS using ASIHTTP
Steps to implement
1) Send request to your web serverNSString *soapMessage = [NSString stringWithFormat:@""
@"
@"
@"Your web service method"
@"
@"
3) Add header to
[
4) Append data with
[
5) Set request method
[
6) S
[
7) S
request.delegate=self;
8) S
[
Tuesday 24 May 2011
Custom Tabbar for iOS
// mytabbar . h
#import
@class AppDelegate;
@interfacemytabbar :UITabBarController
{
AppDelegate *appDelegate;
NSMutableArray *arrayofButton;
BOOLisRotate ;
}
@property (nonatomic, retain) NSMutableArray *arrayofButton;
-(void ) tabBarAction : (UIButton*) sender;
-(void ) setFrameForPortrait ;
-(void ) setFrameForLandScap ;
@end
*******************
//mytabbar . m
*******************
#import mytabbar.h"
#import "myvc1.h"
#import "myvc2.h"
@implementationmytabbar
@synthesize arrayofButton;
-(void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear : YES];
}
- (void)viewDidLoad {
[super viewDidLoad];
appDelegate=( AppDelegate*) [[UIApplication sharedApplication] delegate];
self.tabBarController.delegate=self;
arrayofButton = [[NSMutableArray alloc] init];
self . view. autoresizesSubviews=YES;
self . view. autoresizingMask=UIViewAutoresizingFlexibleHeight||UIViewAutoresizingFlexibleWidth;
NSMutableArray *controllerarray=[[NSMutableArray alloc] init];
UIImageView *tabBarBG=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Toll_bar.png"]];
tabBarBG . frame=CGRectMake( 0, 0, 1024,50);
[self . tabBar addSubview : tabBarBG ];
myvc1 *loc=[[myvc1 alloc] initWithNibName:@"myvc1" bundle:nil];
UINavigationController *nav_loc=[[UINavigationController alloc] initWithRootViewController:loc];
[nav_locsetNavigationBarHidden : FALSE];
loc . tabBarItem . image=[ UIImage imageNamed: @"tabTempImage1.png"];
loc . tabBarItem . title=@"Locations";
[controllerarray addObject : loc];
[nav_loc release];
[loc release];
myvc2 *loc2=[[myvc1 alloc] initWithNibName:@"myvc1" bundle:nil];
UINavigationController *nav_loc2=[[UINavigationController alloc] initWithRootViewController:loc2];
[nav_loc2setNavigationBarHidden : FALSE];
loc2. tabBarItem . image=[ UIImage imageNamed: @"tabTempImage1.png"];
loc2. tabBarItem . title=@"Locations";
[controllerarray addObject:loc2];
[nav_loc2 release];
[loc2 release];
self . viewControllers=controllerarray;
[controllerarray release];
isRotate=NO;
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:YES];
UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
[self . tabBar addSubview:btn1];
[btn1 setImage:[UIImage imageNamed:@"Tab0.png"] forState:UIControlStateNormal];
[btn1 setImage:[UIImage imageNamed:@"Tab0_s.png"] forState:UIControlStateSelected];
btn1.tag = 0;
btn1.frame = CGRectMake(0+109,0,110, 48);
[btn1 addTarget:self action:@selector(tabBarAction:) forControlEvents:UIControlEventTouchUpInside];
[arrayofButton addObject:btn1];
UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
[self . tabBar addSubview:btn2];
[btn2 setImage:[UIImage imageNamed:@"Tab1.png"] forState:UIControlStateNormal];
[btn2 setImage:[UIImage imageNamed:@"Tab1_s.png"] forState:UIControlStateSelected];
//[btn2setTitle : @"Sosh" forState : UIControlStateNormal];
btn2. tag = 1;
btn2.frame = CGRectMake(219,0,110, 48);
[btn2 addTarget:self action:@selector(tabBarAction:) forControlEvents:UIControlEventTouchUpInside];
[arrayofButton addObject:btn2];
[btn2setSelected : YES];
self . selectedIndex=1;
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
UIButton *b = [arrayofButton objectAtIndex:tabBarController.selectedIndex];
[self tabBarAction:b];
}
-(void) tabBarAction:(UIButton*)sender{
UIButton *btn = sender;
self . selectedIndex = btn . tag;
for (int i=0; i < [arrayofButton count]; i++) {
UIButton *b = [arrayofButton objectAtIndex:i];
[b setSelected : NO];
}
self.selectedIndex =0;
self.selectedIndex=btn.tag;
[btn setSelected : YES];
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ( interfaceOrientation == UIInterfaceOrientationPortrait||interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown )
{ [self setFrameForPortrait];
}
if( interfaceOrientation == UIInterfaceOrientationLandscapeLeft||interfaceOrientation==UIInterfaceOrientationLandscapeRight)
{
[self setFrameForLandScap ];
}
return YES;
}
-(void) setFrameForPortrait{
int temp=109;
NSLog( @"setFrameForPortrait=%f", self. tabBarController . tabBar . frame. origin. x);
//[self . tabBarController . tabBar setFrame : CGRectMake( 0, 0, 768, 50)];
for (int i=0; i < [arrayofButton count] ; i++)
{
UIButton *b = [arrayofButton objectAtIndex:i];
if ( i==0)
{
b. frame = CGRectMake( i+temp, 0, 110, 48);
} else {
b. frame = CGRectMake( i*110+temp, 0, 110, 48);
}
}
}
-(void) setFrameForLandScap{
CGRect cg=self. tabBarController . selectedViewController . view. frame;
NSLog( @"setFrameForLandScap=%@", NSStringFromCGRect( self. tabBarController . tabBar . frame));
//[self . tabBarController . tabBar setFrame : CGRectMake( 0, 0, 1024, 50)];
NSLog( @"%@", NSStringFromCGRect( cg ));
int temp=237;
for (int i=0; i < [arrayofButton count] ; i++) {
UIButton *b = [arrayofButton objectAtIndex:i];
if ( i==0)
{
b. frame = CGRectMake( i+temp, 0, 110, 48);
} else {
b. frame = CGRectMake( i*110+temp, 0, 110, 48);
}
}
}
@end
#import
@class AppDelegate;
@interface
{
BOOL
}
@property (nonatomic
-(
-(
-(
@end
*******************
//
*******************
#import mytabbar.h"
#import "myvc1.h"
#import "myvc2.h"
@implementation
@synthesize arrayofButton;
-(void)viewWillAppear:(BOOL)animated
{
[
}
- (void)viewDidLoad {
[
appDelegate=
self.tabBarController.delegate=self;
arrayofButton = [[NSMutableArray alloc] init];
NSMutableArray *controllerarray=[[NSMutableArray alloc] init];
UIImageView *tabBarBG=[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Toll_bar.png"]];
[
myvc1 *loc=[[myvc1 alloc] initWithNibName:@"myvc1" bundle:nil];
UINavigationController *nav_loc=[[UINavigationController alloc] initWithRootViewController:loc];
[nav_loc
[
[nav_loc release];
[
myvc2 *loc2=[[myvc1 alloc] initWithNibName:@"myvc1" bundle:nil];
UINavigationController *nav_loc2=[[UINavigationController alloc] initWithRootViewController:loc2];
[nav_loc2
loc2
loc2
[
[nav_loc2 release];
[loc2 release];
[
isRotate=NO;
}
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:YES];
UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeCustom];
[
[btn1 setImage:[UIImage imageNamed:@"Tab0.png"] forState:UIControlStateNormal];
[btn1 setImage:[UIImage imageNamed:@"Tab0_s.png"] forState:UIControlStateSelected];
btn1.tag = 0;
btn1.frame = CGRectMake(0+109,0,110, 48);
[btn1 addTarget:self action:@selector(tabBarAction:) forControlEvents:UIControlEventTouchUpInside];
[
UIButton *btn2 = [UIButton buttonWithType:UIButtonTypeCustom];
[
[btn2 setImage:[UIImage imageNamed:@"Tab1.png"] forState:UIControlStateNormal];
[btn2 setImage:[UIImage imageNamed:@"Tab1_s.png"] forState:UIControlStateSelected];
//[btn2
btn2
btn2.frame = CGRectMake(219,0,110, 48);
[btn2 addTarget:self action:@selector(tabBarAction:) forControlEvents:UIControlEventTouchUpInside];
[arrayofButton addObject:btn2];
[btn2
}
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[
// Release any cached data, images, etc. that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[
}
- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController {
UIButton *b = [arrayofButton objectAtIndex:tabBarController.selectedIndex];
[self tabBarAction:b];
}
-(void) tabBarAction:(UIButton*)sender{
UIButton *b = [arrayofButton objectAtIndex:i];
[
}
self.selectedIndex =0;
self.selectedIndex=btn.tag;
[
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
{ [self setFrameForPortrait];
}
if( interfaceOrientation == UIInterfaceOrientationLandscapeLeft||interfaceOrientation==UIInterfaceOrientationLandscapeRight)
{
[
}
return YES;
}
-(void) setFrameForPortrait{
int temp=109;
NSLog
//[
for (int i=0; i < [arrayofButton count] ; i++)
{
UIButton *b = [arrayofButton objectAtIndex:i];
{
}
}
}
-(void) setFrameForLandScap{
NSLog
//[
NSLog
UIButton *b = [arrayofButton objectAtIndex:i];
{
}
}
}
@end
Friday 20 May 2011
Twitter integration with OAuth for iOS
Step by step guide for connecting to twitter with OAuth.
You can download source code as well asSDK from below link:
More..
You can download source code as well as
More..
Subscribe to:
Posts (Atom)
iOS interview questions
What is the difference between underscore and self (i.e self . xx and _xx) ? What is property? What is the difference between weak and ...
-
What is the difference between underscore and self (i.e self . xx and _xx) ? What is property? What is the difference between weak and ...
-
Step by step guide for connecting to twitter with OAuth. You can download source code as well as SDK from below link: More..
-
Steps to implements : 1] First add "Quardcore" framework and import it. 2] In view did load method write following code snip...