Posts

Showing posts from July, 2018

how to set device orientation in swift 4

var  isStarted:Bool! func returnedOrientation() ->AVCaptureVideoOrientation   {                var videoOrientation: AVCaptureVideoOrientation!          let orientation = UIDevice.current.orientation                   switch orientation {                    case .unknown:             break                  case .portrait:  videoOrientation = .portrait          case .portraitUpsideDown:             videoOrientation = .portraitUpsideDown          case .landscapeLeft:             videoOrientation = .landscapeRight          case .landscapeRight:             videoOrientation = .landscapeLeft          case .faceUp: break          case .faceDown:break          }          return videoOrientation      }      @IBAction func btnRecordVideoClicked(_ sender: Any)  {          if isStarted == false  {              isStarted = true             //self.sartTimer()             movieOutput.connection(with: AVMediaType.video)?.videoOrientation = returnedOrient

how to display popover in TableView cell in swift

Follow this steps and get popOver STEP 1:- Create New Project "popOverDemo" STEP 2:- install pod "Popover" STEP 3:-  and Drag and drop UITableView. STEP 4:- set The consternt. STEP 5:- Copy and Pest this code. import UIKit import Popover class ViewController: UIViewController,UITableViewDelegate,UITableViewDataSource,UIPopoverPresentationControllerDelegate {     // MARK:- ---------- OUTLET Declaration ------------     @IBOutlet var myTableViewObj: UITableView!     // MARK:- ---------- Variable Declaration ------------     var userNameArray = [String]()     fileprivate var popover: Popover!         //MARK:- ------- View Life Cycle Functions ---------     override func viewDidLoad() {         super.viewDidLoad()         myTableViewObj.delegate = self         myTableViewObj.dataSource = self         userNameArray = ["Robart","Tom","Jon","Piter","Harry","Robart","Tom","Jon"]   

how to custom TableView with Header in swift

struct cellNames {  var isHidden:Bool  var arrayName:[String]() } import UIKit class CustomTableViewDemo : UIViewController, UITableViewDataSource , UITableViewDelegate {  // MARK:- ---------- OUTLET Declaration ------------     @IBOutlet var myTableViewObj: UITableView!             // MARK:- ---------- Variable Declaration ------------     var myArray = [Array]()     var cell1Array = [String]()     var cell2Array = [Sreing]()     var cell3Array = [String]()     var cell4Array = [Sreing]()        // MARK:- ---------- VIEW LifeCycel ------------     override func viewDidLoad() {         super.viewDidLoad()            cell1Array = ["Data 1:1","Data 1:2","Data 1:3","Data 1:4", "Data 1:5", "Data 1:6", "Data 1:7"]       cell2Array = ["Data 2:1","Data 2:2"]        cell3Array = ["Data 3:1","Data 3:2","Data 3:3","Data 3:4"]        cell4Array = ["Data 4:1&qu

How to Set custom UICollectionView View border in swift

Follow this steps and get custom collectionview STEP 1:- Create New Project "CustomCollectionViewDemo" STEP 2:- Go main.Storybord and Drag and drop UICollectionView. STEP 3:- set The consternt. STEP 4:- Copy and Pest this code. import UIKit class CustomCollectionViewDemo : UIViewController, UICollectionViewDataSource , UICollectionViewDelegate {  // MARK:- ---------- OUTLET Declaration ------------     @IBOutlet var myCollectionObj: UICollectionView!             // MARK:- ---------- Variable Declaration ------------     var myArray = [String]()        // MARK:- ---------- VIEW LifeCycel ------------     override func viewDidLoad() {         super.viewDidLoad()                 myArray = ["Item 1","Item 2","Item 3","Item 4"]             }     func numberOfSections(in collectionView: UICollectionView) -> Int     {         return 1     }      func collectionView(_ collectionView: UICollectionView, numberOfItem

How to present side by side UIview using UIScrollView.

Follow this steps and get paging view side by side STEP 1:- Create New Project "PagingViewDemo" STEP 2:- Go main.Storybord and Drag and drop UIScrollView. STEP 3:-  and Drag and drop UIView on UIScrollView. STEP 4:-  and Drag and drop  UIImageView on UIView STEP 4:- set The consternt. STEP 5:- Copy and Pest this code. //Mark:- My UIView Class class myViewClass: UIView {  @IBOutlet var myImage: UIImageView! } //MARK:- my UIViewController class import UIKit class PagingViewDemo: UIViewController,UIScrollViewDelegate {        // MARK:- ---------- OUTLET Declaration ------------     @IBOutlet var scrollingPageControl: UIPageControl!     @IBOutlet var pagingScrollView: UIScrollView!         // MARK:- ---------- Variable Declaration ------------     var imageArray = [String]()        // MARK:- ---------- VIEW LifeCycel ------------     override func viewDidLoad() {         super.viewDidLoad()                 imageArray = ["Banner1.jpg","B