cocoa-touch

TableView Images does not load until scrolling

大憨熊 提交于 2019-12-25 07:49:12
问题 I'm using Firebase to load my images into my cell's ImageView but! there is a problem. I'm using caching mechanism for preventing images to redownload when reusable cells loads but the images do not load until i've scroll my TableView . Here is the code; public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView.dequeueReusableCell(withIdentifier: "cell") as! TableViewCell cell.imgv.image = nil if let urlString = self

Does changing a button's title prevent further action?

被刻印的时光 ゝ 提交于 2019-12-25 07:47:25
问题 I have a bar button, let's call it button 1, which when clicked, programatically segues to a different page. However, after clicking another button (button 2), button 1's title is changed. From then on, button 1 no longer responds regardless of whether it's title has been changed back by clicking button 2 again. I hope you understand, if not - I can clarify code: (button 2 is edit) - (1 is info/add) -(void)editButton:(id)sender { [self setEditing:(![self isEditing])]; self.navigationItem

Can I set maximum alpha for CATransition?

懵懂的女人 提交于 2019-12-25 07:37:11
问题 Is it possible to adjust the maximum alpha (opacity) in a CATransition for when the views fade in and out? What I want is something that looks like a modal segue. Compared to a default modal segue, the transition given by CATransition is very «dramatic». Say I have two views. A: the view I want to transition from. B: the view I want to transition to. I want B to come moving in from the bottom over A. For this I use the kCATransitionMoveIn type, with subtype kCATransitionFromTop (which is

UITableView batch update rows

别说谁变了你拦得住时间么 提交于 2019-12-25 07:24:14
问题 By updating the table, is there a difference, when i call let's say insertRowsAtIndexPaths more times, with an array of 1 object, comparing to calling it once, with an array of all objects? This question also applies to reload, and delete, not just insert This may look like a trivial question, but the update mechanism is quite complex, especially if you mix inserts, deletes, reloads and not sure if this can affect the animation [self.tableView beginUpdates]; [self.tableView

Equality of Two NSMutableSets Using Custom Class Attributes

烈酒焚心 提交于 2019-12-25 06:42:20
问题 How do you check if two NSMutableSets are equal ( same members, same number of members )? My implementation of isEqualToSet does not seem to be working. // members is a NSMutableSet of AUser objects // users is also a NSMutableSet of AUser objects, it is an attribute of instances of the AGroup class [[group valueForKey:@"users"] isEqualToSet:members] AGroup - users AUser - name (String) How do I check if the sets are equal by checking their name attributes? Sorry for my lack of knowledge, it

Simple drawing with Quartz - Core Graphics

大城市里の小女人 提交于 2019-12-25 06:41:05
问题 I want to draw a rectangle with the top-left corner rounded with 3 sub-spaces in it. Something like this: _______ |_|_____| | | |_______| But for some reason I cannot get the inner two lines drawn. - (void) drawRect:(CGRect)rect{ CGContextRef context = UIGraphicsGetCurrentContext(); float cornerRadius = 25.0; float w = self.bounds.size.width; float h = self.bounds.size.height; CGContextMoveToPoint(context, cornerRadius, 0); CGContextAddQuadCurveToPoint(context, 0, 0, 0, cornerRadius);

How can I determine the User-Agent for an iOS application's HTTP request?

限于喜欢 提交于 2019-12-25 06:31:32
问题 I have an iOS application that downloads an xml file using: NSURL *queryURL = [NSURL URLWithString:query]; NSData *xmlData = [[NSData alloc] initWithContentsOfURL:queryURL]; The call is made to a third-party, so I'm not in control of the servers. The third party needs to know what that user-agent is (they are optimizing the feed based on the user-agent) My question is how can I determine what my user-agent is? I don't specifically set that anywhere and didn't find anything in the

Save struct in background mutating function

浪子不回头ぞ 提交于 2019-12-25 05:51:36
问题 I'm trying to save a struct in background but I get this error : closure cannot implicitly capture a mutating self parameter This is my code : //MARK: Parse self methods fileprivate mutating func ParseSave(_ completionBlock: @escaping SuccessCompletionBlock) { let message: PFObject = PFObject(className: "Message") if let id = self.id { //this object exit just update it message.objectId = id } // set attributes if let text = self.text { message["text"] = text } message["sender"] = PFUser

Some part of the screen is not clickable in SWIFT

谁都会走 提交于 2019-12-25 05:34:43
问题 I have a nested UIview under my view controller (landscape mode) that holds 2 buttons. The first button is placed on the left side of the screen and the second button is located at the right most. I'm just wondering why only 1/4 part of the 2nd button is working. I re-arranged that button on the 0 axis and it worked well. I think there's something wrong on the frame that I passed on the uiview. Please see my code. import UIKit class ViewController: UIViewController { var screenHolder

Some part of the screen is not clickable in SWIFT

有些话、适合烂在心里 提交于 2019-12-25 05:34:01
问题 I have a nested UIview under my view controller (landscape mode) that holds 2 buttons. The first button is placed on the left side of the screen and the second button is located at the right most. I'm just wondering why only 1/4 part of the 2nd button is working. I re-arranged that button on the 0 axis and it worked well. I think there's something wrong on the frame that I passed on the uiview. Please see my code. import UIKit class ViewController: UIViewController { var screenHolder