Tag: iphone

FetchRequest – NSArray element failed to match the Swift Array Element type – Swift 2.0

I want to do a NSFetchRequest to display my data into a UICollectionView : import UIKit import CoreData let appDelegate: AppDelegate = UIApplication.sharedApplication().delegate as! AppDelegate let context: NSManagedObjectContext = appDelegate.managedObjectContext class GarageViewController: UIViewController, UICollectionViewDelegate,UICollectionViewDataSource { @IBOutlet weak var backgroundView: UIImageView! @IBOutlet weak var collectionView: UICollectionView! var voitures: [Voiture] = [Voiture]() override func viewDidLoad() { super.viewDidLoad() […]

Custom cell: fatal error: unexpectedly found nil while unwrapping an Optional value

I have a table view with custom cell that was created as .xib . I didnt use storyboard. I have a problem that I couldnt fill my table with the data which came from webservice result. Also, I have 4 labels in the custom cell. In my custom cell class, when I try to set […]

Refreshing UITableView Asynchronously after Core Data Loaded Swift

I have a UITableView, tViewNews I have a refresh function which downloads data from my server, stores it into core data, and then the table view loads this data from core data. It works perfectly func refresh(refreshControl: UIRefreshControl) { self.newsArray = [NewsItem]() self.newslists = [[NewsItem]]() self.getNewsFromServer() self.getNewsFromCoreData() self.tViewNews.reloadData() refreshControl.endRefreshing() } Now, when the user first […]

How to increase the single row height without reloading UITableView or individual cells ?

I want to expand the row height and show the content inside. I show my content in view I want when I tap on a cell it should expand like showed in the image below but without reloading the UITableview. What I have tried till now. 1) I tried expanding the view inside but it […]

Resizing the height of UILabel to fit text

I have UILabel in my Cell Subclass which is suppose to hold a title. The size of the title can be various lengths and therefor I need to resize the UILabel to fit the text and to prevent that the text is not to long I also need to be able to set maxHeight. The […]

Type 'Int32' does not conform to protocol 'AnyObject' Swift?

I have a Model, subclass of NSObject, looks like as below. class ConfigDao: NSObject { var categoriesVer : Int32 = Int32() var fireBallIP : String = String () var fireBallPort : Int32 = Int32() var isAppManagerAvailable : Bool = Bool() var timePerQuestion : String = String () var isFireballAvailable : Bool = Bool () } […]

App is freezing in 'peek and pop' implementation in iPhone 6s

I have implemented peek and pop in my app and it works perfectly. But on continuously trying it for 7-8 times, the app freezes on peek view. The only option I have is to kill the app and re-run. Please let me know the reason for the freeze. I have used the following code for […]

Swift : Error: 'required' initializer 'init(coder:)' must be provided by subclass of 'UIView'

I have a problem when I build my app in swift 2. Xcode says: ‘required’ initializer ‘init(coder:)’ must be provided by subclass of ‘UIView’ This is the code of the class : class creerQuestionnaire: UIView { @IBOutlet weak var nomQuestionnaire: UITextField! @IBOutlet weak var question: UITextField! @IBOutlet weak var reponse: UITextField! var QR: Questionnaire @IBAction […]

Swift: remove layer, without removing UIView in UITableViewCell

I have UITableViewCell with UIView in it. I made some CABasicAnimation and attach it to new CAShapeLayer, then I add this layer to my super layer in my UITableViewCell: self.layer.addSublayer(myLayer!) All nice except that myLayer (and his animation) showing above my UIView. I want that label be below UIView. I achieve this by adding my […]

App crash on device but works on simulator iOS

App wasn’t developed by me, but now I have to add some features. Code compiles add launches on simulator but immediately crash on real device (didFinishLaunchingWithOptions never calls). Xcode doesn’t show any errors. I think the problem may be in pods and frameworks but don’t know how to check if this so. I reinstalled pods […]