[Solved] How to add UILabel from a loop? [closed]

You should actually create the label and place it on your view. UILabel *display = [[UILabel alloc] init]; display.text = [chars objectAtIndex:i]; display.frame = CGRectMake(x, y, 14, 22); display.textColor = [UIColor whiteColor]; [self.view addSubView:display]; solved How to add UILabel from a loop? [closed]

[Solved] How to get minimum & maximum value in a NSString/String array?

@user3815344’s answer works, however you can simplify it by using minElement and maxElement to retrieve the minimum and maximum values. For example: let arr = [“55a”, “95a”, “66”, “25”, “88b”, “#”] let numbers: [Int] = arr.reduce([]) { if let num = “”.join($1.componentsSeparatedByCharactersInSet(NSCharacterSet.decimalDigitCharacterSet().invertedSet)).toInt() { return $0 + [num] } return $0 } minElement(numbers) // 25 maxElement(numbers) … Read more

[Solved] how to have UIImage below UILabel or UITextView in a scrollview

You must implement your UIScrollView and then add the desired subview (UIImageView and UILabel in your case). In you viewDidLoad: UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height)]; scrollView.backgroundColor = [UIColor redColor]; UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, scrollView.frame.size.width * 2, 100)]; imageView.backgroundColor = [UIColor blueColor]; UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(imageView.frame.size.width, 0, … Read more

[Solved] Populate CollectionView and TableView using objects at different index of same array [closed]

You can use filter method of array: //this filter will return you all objects whose group type is equal to 1 let collectionArray = (product_groups?.filter({$0.group_type == 1})) //this filter will return you all objects whose group type is equal to 2 let tableArray = (product_groups?.filter({$0.group_type == 2})) For group title to be section header: – … Read more

[Solved] Editor placeholder in source file swift [duplicate]

You need to write it like this: func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: “MenuCollectionViewCell”, for: indexPath) as! MenuCollectionViewCell return cell } 3 solved Editor placeholder in source file swift [duplicate]

[Solved] How to open Documents files of device programmatically in iOS [closed]

To open office files within an iOS app you can: 1- Use UIWebView . Here is a sample code with a document included in the app’s resources. NSString *path = [[NSBundle mainBundle] pathForResource:@”document” ofType:@”ppt”]; NSURL *url = [NSURL fileURLWithPath:path]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [self.webView loadRequest:request]; 2- You can use the QuickLook framework to preview … Read more