Today Extension: how to display long text? - ios8-today-widget

I don't know whether I'm doing something wrong or if it's not possible: I'd like to display a longer text, but the height seems to be limited to 568 pixels (Maximum height of iOS 8 Today Extension?). I'm using a UITextView, so I would expect it to scroll, but that's not possible either.
Isn't there any way to display the full text?

Displaying such large text on a Notification Center widget, especially in iPhone 4S, 5 or 6, where space is limited, is a bad idea.
Instead, show a preview of the text, indicate that there is more text, and add a button to open the full app to read the rest of it.

Related

Adaptive Layout in Xcode 7.0.1

I have an app that displays properly in portrait view but truncates in landscape view:
From the research I have done it looks like I need to understand Size Classes and Adaptive Layout. However, I am only concerned with layout on iPhone 6, not across different devices (eg iPad).
Before jumping into Adaptive Layout and Size Classes, which seems quite a complex topic, I just wanted to ask if there is a simple way to make this app display properly in both portrait and landscape for iPhone 6.
Thanks in advance!
Yes, you can do it without size classes, but it requires a reasonable modification to your UI.
If you think about it then having a picker always visible makes no sense for you. Looking at your image I am puzzled as to which date is currently being adjusted.
What you want to do instead, is to make your picker appear after user clicks on one of the dates. You can make it slide up from the bottom. In addition, you can add a label above it which will clearly indicate which date the user is currently modifying. That label can be placed in the toolbar to make it easy to add "Done" and "Cancel" buttons to the left and to the right.
In my view it would make much more sense and would also solve your problem. The rest of the UI can be put in the scroll view if you don't have enough space on old devices (e.g. 3.5 inch iPhones)

Xcode UILabel fit screen

Hi quick question I'm want to allow my UILabel to auto adjust depending on what the phone, for example when I run my program on a iPhone 5 the labels fit perfectly but when simulating on a iPhone 6 label are still displaying at iPhone 5 size, do I need to adjust the constraint or implement a line of code.
Thanks
Constraints are the best way to go with resizing, there is no 1 line of code solution that will resize all of your labels depending on screen size unfortunately

Scale images and buttons of layout in Xcode

How can I stretch the height of buttons and images in Xcode 4.6.3 in Storyboard?
I have a simple navigation with some images and a few navigations buttons as per the images below. In the first image its displayed on iPhone 4 and on image 2 its on iPhone 5. As you can see the buttons are now looking a bit lost on the bigger display.
Can I stretch the buttons' height for the iPhone 5 in Storyboard? I have seen examples of using Autolayout but they all seem to do with orientation (switching from portrait to landscape).
Can what I need to do be done with Struts and Springs perhaps? I am unable to test at the moment as I only have access to Xcode once a week. Just want to have as much information for the next time I get to work on project.
iPhone 4 display
iPhone 5 display
that's actually really easy to awnser! Just use autosizing. Here is what you need to do:
Xcode 4.5: How do I fix my text views so they display properly in portrait and landscape mode on an iPad?
Just play around with the inner cross and see what happens. You need to set the autosizing for every button if you want to resize them all.
Have a good one,
Noah

grow or shrink UIImageView frame to fit the entire iPhone screen via AutoLayout?

So I'm still getting accustomed to the world of Auto Layout in iOS 6 and it's been a fun (or in plain English -- tough) migration coming over from strings & struts.
I have a UIImageView that's the background for a game I'm working on. Here's what a regular 3.5" Retina Display looks like in Interface Builder:
but if I change the "Size" pop-up in the Simulated Metrics field for the content view to "Retina 4 Full Screen", here's what I see:
And you can see the ugly black bar appearing along the bottom edge of the simulated iPhone 5 screen. This same ugly black bar makes it over to the compiled app running in the iPhone 5 simulator.
Are there any attributes or constraints I can apply via Interface Builder to get the UIImageView's frame to size correctly for the appropriate iPhone device screen size?
Or do I have to enter in constraints via code? (ugh)
I've watched the three WWDC videos and if the engineers covered the topic of sizing a view to fit a parent, they must have glossed over it really fast because I've haven't yet found or heard a decent method to get both UIImageView and NSImageView to size correctly to their parent views under both the iOS and MacOS side.
From what you're showing here, I think that what you want to do is drag the image to meet the bottom of the superview so that it takes up all of the space you want. On the bottom right in the IB view you will see a small, grey pill-shaped set of 3 buttons. Click the center one (once you have your imageView selected). It's the one that looks a little like this: |--|. It will bring up a list of constraints. Once you have done that, select "Bottom Space to Superview". You should then be able to switch between phones and have the image resize automatically.

How to draw images among rich-text with CoreText? (iOS)

I can draw rich-text with Core Text, the problem is placing images flowing with the text.
(iOS SDK 4.1)
I'm try to drawing some kind of rich-text. Problem is designer placed many icons among text. So the text what I have to draw is something like this:
Here is a word <an icon image>, and another words.
The image(<another icon>) should be placed like a glyph.
It's part of text, not an example.
<icon> are images. (This is not a code. Just an illustration.)
I can draw this by laying out all of them manually, but it's too hard keeping complex text layout behaviors. So I'm finding a way to draw this with Core Text.
I got solution.
The key of laying out non-text content is CTRunDelegate.
Core Text does not support non-text content, so you have to make blank spaces for them, and draw or place them yourself later.
A part of NSAttributedString attributed with kCTRunDelegateAttributeName will call registered callback to determine width of each glyph. This will let you make blank space for each non-text object.
However, after drawing the text with Core Text, the layout information stored with frame/line/run will invalidated. So you have to draw/place non-text contents after layout with framesetter/typesetter, but before drawing.
This link describes basic usage of CTRunDelegate:
How to use CTRunDelegate in iPad?
There is a problem with Core Text. Originally, CTRunDelegate designed to support variable width and vertical alignment via CTRunDelegateCallbacks.getAscent and CTRunDelegateCallbacks.getDescent. But vertical alignment feature doesn't work currently. This might be a bug.
I described this problem here:
Aligning multiple sized text vertical center instead of baseline with Core Text in iOS
If you have informations about this problem, please see my question at the link.
You simply set a delegate for a given CTRun and the delegate object is responsible to let know Core Text what is the CTRun ascent space, descent space and width.
When Core Text "reaches" a CTRun which has a CTRunDelegate it asks the delegate - how much width should I leave for this chunk of data, how high should it be? This way you build a hole in the text - then you draw your image in that very spot.
Here is a blog about Core Text.It has the answer for you .
How To Create a Simple Magazine App with Core Text

Resources