This question already has answers here:
Redrawing NSTextAttachments in an UITextView with attributed text
(3 answers)
Closed 6 years ago.
I have an NSTextAttachment which I want to show a loading image until the image has downloaded and then once it has I want to update the image.
I have all of the logic in place, except when I call textAttachment.image = image the second time nothing happens.
How can I update the NSTextAttachment once it has already been rendered by the UITextView?
Thanks!
You must always update the user interface from the main thread, not from the socket thread.
Here is a Swift example:
// Update UI from main thread
dispatch_async(dispatch_get_main_queue(), {
textAttachment.image = image
})
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm trying to make an app that has a calendar that takes up about 2/3 of the visible screen, and then under it are events that correspond to the selected day.
Basically it will look something like this: Calendar App
Should I use a UIView for the calendar, and then a UITableView for the corresponding information?
Also, I want the entire page to scroll when users scroll through the events in the tableView (not just the information in the table view). Would I need to wrap the entire page in a scrollView to accomplish this?
You don't need to have a UIScrollView. You can simply hide the calendar (with animation) when the table view scrolls to a certain point.
Another simpler solution is to put your calendar in the first table view cell, so it would scroll along with your events. So this one just requires one UITableView that fills up the whole screen.
This question already has an answer here:
Cocoa - Capturing NSStatusItem mouse hover event
(1 answer)
Closed 8 years ago.
I've successfully added a NSStatusItem to the menu bar, showing an regular NSMenu.
Is it possible to capture a hover event on this and in that case, display a different menu?
You need to create a new custom view, override method [NSView mouseEntered:] with [NSView addTrackingRect:...] and then set to the status item [NSStatusItem setView:]
This question already has answers here:
Respond to mouse events in text field in view-based table view
(6 answers)
Closed 9 years ago.
I have a view based NSTableView in which the cells contain a number of controls including text fields and edit fields. When a user tries to click on a control within a cell in order to, for example, start editing a text field, the click's main objective is ignored and the cell gets selected. Another click is then needed to perform the action originally intended, and even this click is subject to a delay before it's taken into account.
How can I avoid this problem and have the row selected and the mouse event forwarded to the control in one go?
I solved this issue by subclassing NSTableView:
#implementation QuickResponseTableView
- (BOOL)validateProposedFirstResponder:(NSResponder *)responder forEvent:(NSEvent *)event
{
// This allows the user to click on controls within a cell withough first having to select the cell row
return YES;
}
#end
Had the same problem. After much struggle, it magically worked when I selected None as against the default Regular (other option is Source List) for the Highlight option in IB! The accepted answer appears to be more specific but a little hacky compared to this.
This question already has an answer here:
Closed 11 years ago.
Possible Duplicate:
How to get touch pointer inside a specific Grid
I have a Windows Phone 7 application needs 10x10 images inside a grid.
And I'd like to have touch event on each of them but I don't what to write 100 if statements.
Someone tell me to use a control wrap this grid 100 images and set a click event on that control. Can someone show me an example or details with code (xml and cs) on how to do that?
Download WrapPanel form Silverlight toolkit for WP7 and use it as a Content Presenter in ListBox. Example.
This question already has answers here:
Cannot hide Controls in NSView
(2 answers)
Closed 9 years ago.
I am developing an application in cocoa.I need to hide a progress bar placed in an NSView
and show an NSTextfield in that place .I used the following cod
[progressbar setHidden:TRUE]
[textfield setHidden:FALSE];
But this code snippet is not working. Is that a bug.??I used to hide the same code to hide certain other text fields in the same page .But that controls became hidden.looking for a solution...
Are progressbar and textfield outlets ? If yes, make sure they are correctly connected in your nib. Also make sure that you call setHidden: from the main thread.
And unrelated to your problem, in Objective-C you should use YES instead of TRUE and NO instead of FALSE.