[Solved] Swfit- Check whether current time is between two time string

You can set the date formatter defaultDate for today, parse the date strings, create a DateInterval with the start and end date and check if it contains now Date(): extension Formatter { static let today: DateFormatter = { let dateFormatter = DateFormatter() dateFormatter.locale = .init(identifier: “en_US_POSIX”) dateFormatter.defaultDate = Calendar.current.startOfDay(for: Date()) dateFormatter.dateFormat = “hh:mm a” return … Read more

[Solved] UITextView if line numbers is 2 [duplicate]

For Count the number of lines of text int numLines = textView.contentSize.height / textView.font.lineHeight; NSLog(@”number of line – %d”, numLines); And for iOS 7 see this Question/Answer. EDIT for iOS < 7: This is proper answer UIFont *myFont = [UIFont boldSystemFontOfSize:13.0]; // your font with size CGSize size = [textView.text sizeWithFont:myFont constrainedToSize:textView.frame.size lineBreakMode:UILineBreakModeWordWrap]; // default … Read more

[Solved] Constrains for ImageView is not working

After researching a bit I have came up with the following way to solved this issue of AutoLayout with UICollectionViewCell. From Xcode 6 CollectionViewCell doesn’t show the contentView in interface builder, so in the awakeFromNib of cell I have set its autoresizingMask and it works like charm. class CustomCell: UICollectionViewCell { @IBOutlet var imageView: UIImageView! … Read more

[Solved] How do I get the shortest path between two given coordinates in MapView? [closed]

You can use Directions API given by Google Maps SDK. Example: https://maps.googleapis.com/maps/api/directions/json?origin=lat,long&destination=lat1,lon1 It takes source and destination latitude and longitude and returns a JSON object of routes and the distance for each route. You can select the shortest route and map it. 0 solved How do I get the shortest path between two given coordinates … Read more

[Solved] When making an if statement can I make it so a void that is already running be overwritten? [closed]

This line sounds strange: if (RedCircle2.hidden = YES, BlueCircle.hidden = YES, YellowCircle.hidden = YES) You are assigning YES to hidden property of RedCircle2, BlueCircle and YellowCircle and this will always be TRUE as a boolean expression…. You probably wants to do this: if (RedCircle2.hidden && BlueCircle.hidden && YellowCircle.hidden) 3 solved When making an if statement … Read more

[Solved] Accessing values from NSArray [duplicate]

As others have said, the variable myarray contains a dictionary. To explain fully: In Objective-C, a variable that contains an object actually contains a pointer to that object. Think of it as an entry in your program’s rolodex. The variable has a type, “pointer to array”. It points to an object that should be an … Read more