[Solved] autolayout- different devices and rotation

Yes, auto layout will do it. you might want to take a look at this tutorial to get started: https://www.raywenderlich.com/115440/auto-layout-tutorial-in-ios-9-part-1-getting-started-2 1 solved autolayout- different devices and rotation

[Solved] Swift – how to read data from many UITextFields which generate data by UIPickerView [closed]

You can set a pickerView as the textField.inputView. The example below is for two text fields sharing a single picker view, but you can extend it easily by checking the identity of the activeTextField in the picker view delegate methods. import UIKit class ViewController: UIViewController, UIPickerViewDelegate, UIPickerViewDataSource { @IBOutlet weak var myTextFieldOne: UITextField! @IBOutlet weak … Read more

[Solved] Why does my app crash when I tap the background?

From the chat with Jack, it appears the culprit of the crash was due to a method: -(void)dismissKeyboard { // —————————————————— // These variables appear to be NSString, so it crashes // —————————————————— [message resignFirstResponder]; [contact1 resignFirstResponder]; [contact2 resignFirstResponder]; [contact3 resignFirstResponder]; } So the solution was to simply change it to: -(void)dismissKeyboard { [self.view endEditing:YES]; … Read more

[Solved] Play local video file in UIwebview [closed]

Try this : NSString* htmlString = [NSString stringWithFormat:@”!DOCTYPE html> <html lang=”en”> <head> <title>test</title> <body> <div> <embed src=”https://stackoverflow.com/questions/24551251/yourVideoName.mov” Pluginspage=”http://www.apple.com/quicktime/” width=”90%” height=”166px” CONTROLLER=”true” LOOP=”false” AUTOPLAY=”false” name=”IBM Video”></embed> </div> </body></html>”]; UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(frame+(i*20), 0, 300, height)]; webview.allowsInlineMediaPlayback = YES; webview.delegate = self; [webview loadHTMLString:htmlString baseURL:[[NSBundle mainBundle] bundleURL]]; [previewScrollView addSubview:webview]; 3 solved Play local video file … Read more

[Solved] How to compare two given times with current time? [duplicate]

Comparing 2 NSDates. … NSDate *date1= [formatter dateFromString:time1]; NSDate *date2 = [formatter dateFromString:time2]; if ([date2 compare:date1] == NSOrderedDescending) { NSLog(@”date1 is later than date2″); } else if ([date2 compare:date1] == NSOrderedAscending) { NSLog(@”date1 is earlier than date2″); } else { NSLog(@”dates are the same”); } UPD: via Switch … NSDate *date1= [formatter dateFromString:time1]; NSDate *date2 … Read more

[Solved] what is the delegate of these NSURLSession methods in Swift?

If you type this into Playground: class Downloader : NSObject, NSURLSessionTaskDelegate, NSURLSessionDownloadDelegate { } and then start typing inside the class URLS you get all the autocompletion stuff. Try that and if this does not work restart Xcode. Maybe “cleaning” the project will also help. Please also note that the methods you reference in your … Read more

[Solved] How to create a shared navigation bar to inter-navigate among multiple views in SwiftUI? [closed]

You would use a TabView {…} to accomplish this. Effectively you instantiate your views inside of the TabView then add an item modifier to each view. var body: some View { TabView { Text(“A”) .tabItem { Text(“A”) } Text(“B”) .tabItem { Text(“B”) } Text(“C”) .tabItem { Text(“C”) } } init() { UITabBar.appearance().backgroundColor = UIColor.red } … Read more

[Solved] Splitting string into substring objective c

If you have a string: NSString *string = @”New Windsor,New York,USA”; You can split it by using a delimiter, in this case a comma , NSArray *splitStrings = [string componentsSeparatedByString:@”,”]; This will give you an array with 3 strings: New Windsor, New York, and USA. You can then manipulate and/or display these however you like. … Read more

[Solved] NSDateFormatter returning nil with dateFromString

NSString *trimmedDOB=@”1992-11-15″; NSDateFormatter *format = [[NSDateFormatter alloc] init]; //Set your input format [format setDateFormat:@”yyyy-MM-dd”]; //Parse date from input format NSDate *dateOfBirth = [format dateFromString:trimmedDOB]; //Set your output format [format setDateFormat:@”MM-dd-yyyy”]; //Output date in output format NSLog(@”DATE IS %@”,[format stringFromDate:dateOfBirth]); 0 solved NSDateFormatter returning nil with dateFromString