I'm porting a PhoneGap application to native iOS targeting iOS 7. One of the elements is a rectangular <div> with another <div> layered on top that has a variable height and produces a meter effect. The best visual I can think of is a thermometer.
Is there a recommended UI element that would simulate this in iOS?
UIView is the closest thing to a general div in HTML. If you override its drawRect: method, you can perform whatever drawing code you'd like using NSGraphicsContext (including just painting the background a certain color). If you want something more elaborate, you can use a UIImageView and display an image for the various parts of your control.
Cocoapods.org has a lot of great reusable iOS components. One that sounds like it may meet your needs is MSSimpleGauge:
https://github.com/sabymike/MSSimpleGauge
Related
I have lots of views - sub classes (UILabel, UIVIew, UIButton etc) using core graphics (within drawrect).
These show fine within normal interface builder.
However they do not show in the preview assistant editor for the storyboard (where you can see how views should look on actual devices).
I've been doing some research and found posts suggesting prepareForInterfaceBuilder should be used. However this doesn't show in preview for me.
I asked this question some years ago, IB_DESIGNABLE, having views show in preview? however I can't reproduce this, I'm not convinced it did work back then either.
I'm still following the same approach, with a framework and that link shows my implementation.
I know that prepareForInterfaceBuilder should be used to do something different, to show something basic. Therefore I believe that core graphics won't work.
However, I can't even get a simple change in background color to work in the preview, although it does work in normal interface builder.
I would like to know if this is a bug (that core graphics can not be used in preview) or still a limitation in xcode?
At the very least I'd like to do something simple (like a change in background color). I have a lot of views and an impossible task to make auto layout changes.
Previously I was producing lots of screen shots, different devices, languages etc (via automation) just so I could see my auto layout changes, which is really slow way to work.
I can verify this is a long standing bug. Apple doesn't care. Custom view be damned. All those dollars spent for more broken Xcode functionality.
Android?
Daniel
I'm developing a web-app, based on the Dribbble API. In this app I have a div which shows all comments with a max-height of 200px, so if there's more than 200px worth on comments, the div gets scrollable. So far so good, works as intended on iOS.
However, when I add a Scale transfrm to this div (to mimic iOS's folder opening animation), scrolling the div breaks entirely. You can see the live version here: http://maxsteenbergen.com/longshot/
Is this fixable by setting a a new style using jQ's webkitAnimationEnd or is this without solution?
EDIT: In the meantime I found that using two fingers to scroll the div works but obviously, this is not how it's supposed to work.
It's also worth noting that scrolling DIV's don't work on older versions of iOS - it might be worth having a look at iScroll.
You can implement native iOS UI and achieve much better UI feedback. especially on scroll view. To obtain data from Dribbble API you may use 3rd-party Dribbble iOS SDK: https://github.com/agilie/dribbble-ios-sdk
I'm new to iPhone/iPad development. I'm looking for a way to visually groups some controls just like the GroupBox in C#. I know it doesn't make much sense in iPhone due to limited space, but my app is for iPad only and customer wish to see that. Any idea?
Not directly. You could simulate it with a Label and a UIView with a little bit of custom drawing (just to draw the border, and an inner shadow if you'd like).
I see that I can create the the UI controls like buttons, labels and textboxes by writing code in the class, and drawing them through the "pushScreen" method.
My question is: can we draw UI design by drag & drop from a toolbox?
I have been working in iPhone development, and expecting that Eclipse would have a similar approach for UI design.
As much as what I know there is no alternate approach for UI design in blackberry except coding. The only approach for UI design in blackberry is through coding.
I'm currently scoping out a project for the iPad which is rather text and font heavy. There are many pages of styled text, which also need custom fonts. I have toyed with the idea of simply rendering PDF or PNG files on-screen, but I think we need to be able to dynamically repaginate the text.
We've used UIWebView in a previous project quite successfully, however there are a few things I don't like about it... Firstly, you have to hide all the silly drop shadow elements to stop them showing when the user scrolls beyond the bounds, and we had to add some JavaScript to find out actually when a page had fully loaded. Overall, the experience seemed a bit clunky, as well as worrying if the project could potentially break if Apple decided to update the subviews...
The other thing we've been looking at is Core Text, which looks very powerful. The only worry with this is that it appears to be a rather steep learning curve for us since we've mainly been working in UIKit (with a bit of Core Graphics). I couldn't even work out how to change the size of the font after a morning's work.
Are there any other alternatives*? Should I stick with Core Text? Is there any way of using UITextView with multiple fonts and styles?
Thanks!
:-Joe
EDIT: *by alternatives, I am really looking for built-in iPhone SDK alternatives only please... I would rather not mess with third party frameworks because I don't have the time... Thanks :)
You could use Pango, which uses CoreText when on iOS.