Label/Text inside NSProgressIndicator? - objective-c

It seems that everybody that needs some text for a NSProgressIndicator (i.e. showing the percentage of a download) ends up putting the text above the widget, or next to it.
Cannot you really show any text inside the NSProgressIndicator widget?
An example of what I mean:

In IB, just embed your progress indicator in a custom view, add a label to that view, and center both the progress indicator and the label within the custom view.

You can put a label where ever you want. The progress indicator doesn't have a text property. So yes, you could put a label onto a progress indicator. If that would look good is an other question.

Related

Is there a way to obtain just the text visible in window in NSView or NSTextView?

I'd like to show information in a second view that's contextualized to what's appearing in the first view. To do that, I'd like to get just the text that's scrolled into view in the NSView. As in the picture I've attached, the whole document is A. The portion that's visible is B. I'm writing this using Objective-C and Swift, so a suggestion in either language would be welcome. Thank you.

How to add text under the button previously placed as leftCalloutAccessoryView of MKPinAnnotationView

I want to basically do this: ETA info under the button with a car image
How can I add text just at the bottom of the button? Thanks in advance.
I have found the solution a long time ago but forgot to mention it here.
Here it is:
Just create a Vertical StackView, set its alignment as Center and distribution as Fill, and put your label and image in it. Make your label hidden at first. Assign the StackView as the leftCalloutAccessoryView. When you got the ETA info, just make the label unhidden inside an animation code.
That's it! It will behave just like in the Apple's Map app.

How to add comment box to page?

I am trying to model my "add comment" interface with what you see in the diagram below. However, I was unable to find such a UI element in the XCode library.
Is this a customized UI element? Or can I find a UI with the same look and feel as what you see in the diagram?
You can approximate it using a UIImageView (the silver gray background) and a UITextView on top of it which has a proper cornerRadius set. You'll need to:
#import <QuartzCore/QuartzCore.h>
in order to be able to set the cornerRadius property of the UITextView like this:
textView.layer.cornerRadius = 1.0f; // play around to see what gives you the above rounded effect to your needs.
Assuming you just want the textfield shape, you can use a UIImageView as background and have a textfield or textview on top of it accordingly...Now if you want that textview to expand thats another story, you can use strechableImageWithleftCapWidth: method on the image in order to be able to strech and expand it, and then you would need to create a custom UITextView class that expands as characters are typed in...

Question about these UIButtons

How can I get a UIButton like the ones at the bottom of this picutre (move and delete)? Specifically, I want an image with a text just like that. http://4.bp.blogspot.com/_QLwms0mVa4w/SQN0MqPIpXI/AAAAAAAAAA8/lEikKn9eP_0/s1600-h/Screenshot+2008-10-25+15:31:21+-0400-1.png
Thanks.
For Jason:
The image sticks right beside the label. Is there anyway from IB I can set it to align to the left, while the label aligns to the right? Here's what it looks like right now:
What you can do is in Interface Builder, the UIButton can be set to a type of "Custom"
After you have done this, you can simply use your own image for the button and different images for each state of the button.
Although with this approach you won't be able to have additional text modified on it like the mail app has with "Delete (1)". However, if you don't need that then this solution will work for you.
Alternatively, if you just want an image stuck onto your existing button then there is an Image property in Interface Builder where you can slap on an image to your button.
If you need more functionality then you would probably have to create your own UIButton by subclassing to handle it.

How to display indeterminate NSProgressIndicator in the NSOutlineView?

I need to display a progress of loading of item's children. Please advise how to implement a progress indicator like it's done in Mail application:
(source: quicksnapper.com)
P. S. Here a source code of using indicator sub-views: http://snippets.dzone.com/posts/show/7684
This is harder than it should be, because Apple does not provide an NSProgressIndicatorCell. While table and outline views support the idea of custom cells being displayed within them, they are not set up to easily support custom subviews.
So the trick becomes, how do you get a a complete NSProgressIndicator view to display and animate at the desired spot in your window, without the ability to actually install it in the table view row?
The trick I've used is to literally install the NSProgressIndicator as a subview of the outline or table view itself. To find the location to add the subview, so it looks like it's "in the row", use the frameOfCellAtColumn:row: method. You can then position your progress indicator within that location of the outline view. When you're done spinning the progress indicator, you probably don't want to show it any more, so just remove it from its superview and discard it.
You will want to make sure you set the required autosizing flags on the progress indicator, so that it floats in the correct direction when/if your outline view is resized.
I'm sure there are other hacks like this to achieve the desired end result. I don't think there is any super-clean way to accomplish this trick.
Vienna is an open-source (Apache license) feed reader that has this in its source list. You should look at the Vienna source code to see how they did it.
Viena's implementation is not perfect. Add a feed to a folder then as it is loading and the progress indicator is busy collapse that folder. You will see the progress indicator still running in the same location.