This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface ViewController : UIViewController { | |
IBOutlet UIPageControl *pageControl; | |
IBOutlet UIScrollView *scrollView; | |
} | |
-(IBAction)changePage:(id)sender; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define SCROLLWIDTH 279 | |
- (void)viewDidLoad { | |
scrollView.contentSize=CGSizeMake(SCROLLWIDTH*3, | |
scrollView.frame.size.height); | |
scrollView.delegate = self; | |
for (int i =0; i<=3; i++) { | |
UIImageView *imageView = [[UIImageView alloc]initWithFrame: | |
CGRectMake(SCROLLWIDTH*i, 0, scrollView.frame.size.width, | |
scrollView.frame.size.height)]; | |
if (i==0) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma mark changePage | |
-(IBAction)changePage:(id)sender | |
{ | |
[scrollView scrollRectToVisible:CGRectMake(SCROLLWIDTH*pageControl.currentPage, scrollView.frame.origin.y, SCROLLWIDTH, scrollView.frame.size.height) animated:YES]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)scrollViewDidEndDecelerating:(UIScrollView *)sender { | |
[self setIndiactorForCurrentPage]; | |
} | |
-(void)setIndiactorForCurrentPage | |
{ | |
uint page = scrollView.contentOffset.x / SCROLLWIDTH; | |
[pageControl setCurrentPage:page]; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// AppDelegate.swift | |
// Facebook-swift | |
// | |
// Created by Aman Aggarwal on 26/02/17. | |
// Copyright © 2017 Aman Aggarwal. All rights reserved. | |
// | |
import UIKit | |
import FacebookCore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// Search_Using_textField_Swift3 | |
// | |
// Created by Aman Aggarwal on 3/20/17. | |
// Copyright © 2017 iostutorialjunction.com. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func searchRecordsAsPerText(_ textfield:UITextField) { | |
searchedArray.removeAll() | |
if textfield.text?.characters.count != 0 { | |
for strCountry in countriesArray { | |
let range = strCountry.lowercased().range(of: textfield.text!, options: .caseInsensitive, range: nil, locale: nil) | |
if range != nil { | |
searchedArray.append(strCountry) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var dataArray:[Dictionary<String, AnyObject>] = Array() | |
var indDictionary = [String: AnyObject]() | |
indDictionary.updateValue("India" as AnyObject, forKey: "parent") | |
var inCitiesArray:[String] = Array() | |
inCitiesArray.append("New Delhi") | |
inCitiesArray.append("Mumbai") | |
inCitiesArray.append("Chennai") | |
inCitiesArray.append("Kolkata") | |
indDictionary.updateValue(inCitiesArray as AnyObject, forKey: "child") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// ViewController.swift | |
// ExpandableTable | |
// | |
// Created by Aman Aggarwal on 3/21/17. | |
// Copyright © 2017 iostutorialjunction.com. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension Date { | |
func getElapsedInterval() -> String { | |
let interval = Calendar.current.dateComponents([.year, .month, .day, .hour, .minute, .second], from: self, to: Date()) | |
if let year = interval.year, year > 0 { | |
return year == 1 ? "\(year)" + " " + "year" : | |
"\(year)" + " " + "years" | |
} else if let month = interval.month, month > 0 { |