[Solved] How to stop or disable portrait/auto rotate app in ios swift?

Try this : By User Interface Programatically Add this in appdelegate func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { return UIInterfaceOrientationMask(rawValue: UIInterfaceOrientationMask.landscape.rawValue) } 1 solved How to stop or disable portrait/auto rotate app in ios swift?

[Solved] Displaying Images in IOS [closed]

You could simply use NSThread link 1 and link 2 or go for AfNetworking this will provide you methods for asynch downloading. Also you could use GCD and other library for dowloading files in asynch manner. solved Displaying Images in IOS [closed]

[Solved] How to compare array of dates with greater than current date

i Resolved my issue by using stack overflow suggestions. and i am posting my answer it may helpful for others. extension Date { var startOfWeek: Date? { let gregorian = Calendar(identifier: .gregorian) guard let sunday = gregorian.date(from: gregorian.dateComponents([.yearForWeekOfYear, .weekOfYear], from: self)) else { return nil } return gregorian.date(byAdding: .day, value: 1, to: sunday) } var … Read more

[Solved] Multiple search in string – swift 4+

You may find a database command to get this kind of search. In swift, it’s easy to construct such a predicate like the following if I understand your requirement right. let multipleSearchString = “my stg l la ma” let texts = [“mystringlladm1a”, “mystr2ingllama”, “mystri2ngllama”, “mys3ringllama”] let key = multipleSearchString.compactMap{ $0 == ” ” ? nil … Read more

[Solved] Disable UIScrollView scrolling out of content

Set bounces property of UIScrollView to false to disable both horizontal and vertical bouncing. To disable horizontal bounce set false to alwaysBounceHorizontal and for vertical bounce set false to alwaysBounceVertical. scrollView.bounces = false or solved Disable UIScrollView scrolling out of content

[Solved] Unexpectedly found nil while unwrapping an optional value while reading JSON [closed]

Instead of guard the data parameter handle the error returned in the completion handler. If there is no error then data can be safely unwrapped. let task = session.dataTaskWithURL(shotsUrl!, completionHandler: { (data,response,error) -> Void in if error != nil { // do proper error handling } else { do { let json = try NSJSONSerialization.JSONObjectWithData(data!, … Read more

[Solved] Creating a subclass of UIView [closed]

Declare your method in your Interface @interface AVView : UIView – (UIView *) buildBestView; @end Use that in the other class AVView *avView = [[AVView alloc] initWithFrame:CGRectMake:(0,0, 100, 100)]; [avView buildBestView]; 3 solved Creating a subclass of UIView [closed]

[Solved] passing data to another VC that is embedded in a navigation controller [closed]

An example to pass data in your case is this : – (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([segue.identifier isEqualToString:@”segueName”]) { SecondClassName *destTableViewController = [[segue.destinationViewController viewControllers] objectAtIndex: 0]; destTableViewController.yourDataInSecondClass=yourDataInFirstClass; }} Care: You must give a name to the segue that connects the First VC with the Navigation Controller and change the segueName in the code above … Read more

[Solved] Literal converstion NSData to NSString [closed]

HINT#1 //general answer NSString provides an initializer for this purpose. You can see more info using the docs here. NSString * str = [[NSString alloc] initWithData: mynsdata encoding:NSUTF8StringEncoding]; Assuming you use ARC. HINT#2 // the answer for hex nsdata int len = [mynsdata length]; NSMutableString *str = [NSMutableString stringWithCapacity:len*2]; const unsigned char *nsdata_bytes = [mynsdata … Read more