Posts
Code for CollectionView
- Get link
- X
- Other Apps
interface file - ( void )viewDidLoad { [ super viewDidLoad ]; [ super viewDidLoad ]; self . collectionView = _collectionView ; self . collectionView . dataSource = self ; self . collectionView . delegate = self ; self . collectionView . backgroundColor = [ UIColor clearColor ]; UICollectionViewFlowLayout *flowLayout = [[ UICollectionViewFlowLayout alloc ] init ]; [flowLayout setScrollDirection : UICollectionViewScrollDirectionVertical ]; flowLayout. minimumInteritemSpacing = 10 ; flowLayout. minimumLineSpacing = 10 ; flowLayout. sectionInset = UIEdgeInsetsMake ( 10 , 10 , 10 , 10 ); [ self . collectionView setCollectionViewLayout :flowLayout]; ...
Code for DateFormatter
- Get link
- X
- Other Apps
NSDateFormatter *dateFormatter=[[ NSDateFormatter alloc ] init ]; NSString *currentDateString = @"2014-01-08T21:21:22.737+05:30" ; [dateFormatter setDateFormat : @"yyyy-MM-dd'T'HH:mm:ss.SSSZ" ]; NSDate *currentDate = [dateFormatter dateFromString :currentDateString]; NSLog ( @"CurrentDate:%@" , currentDate);
code for sending & recievieng the data to the server through Get and Post method in xcode
- Get link
- X
- Other Apps
.h file @interface ConnectionExampleViewController : UIViewController @property ( retain , nonatomic ) NSURLConnection *connection; @property ( retain , nonatomic ) IBOutlet UIButton *btn_post; @property ( retain , nonatomic ) IBOutlet UIButton *btn_get; @property ( retain , nonatomic ) NSMutableData *receivedData; -( IBAction )btn_get_clicked:( id )sender; -( IBAction )btn_post_clicked:( id )sender; .m file -( IBAction )btn_get_clicked:( id )sender { NSMutableURLRequest *request = [[ NSMutableURLRequest alloc ] init ] ; NSString *urlString = @"http://www.example.com/command=18&email=email&exchanges=hong%20kong%20Stock%20Exchange&instrumentclass=Stock&payforservice=YES&country=china" ; [request setURL :[ NSURL URLWithString :urlString]]; [request setHTTPMethod : @"GET" ]; NSString *type = [ NSString stringWithFormat : @"application/x-www-fo...
Find the dot in the string in xcode and remove content after dot (.)
- Get link
- X
- Other Apps
Find the dot in the string in xcode and remove content after dot (.) This will help you to remove the content after and before dot (.) user id =user@abc.com NSUserDefaults *standardUserDefaults2 = [ NSUserDefaults standardUserDefaults ]; userLogedIn = [standardUserDefaults2 objectForKey : @"useremail2" ]; [ userLogedIn stringByReplacingOccurrencesOfString : @"." withString : @"" ]; NSRange range = [ userLogedIn rangeOfString : @"." ]; userLogedIn = [ userLogedIn substringWithRange : NSMakeRange ( 0 , range. location )]; NSLog ( @"user id==>%@" , userLogedIn ); Output: user@abc
B.S.Abdur Rahman University MCA Entrance Examination 2012
- Get link
- X
- Other Apps