Double header on iphone - iphone

I have come across a weird double header/h1 tag on the iPhone 4. If you view the my site on an iPhone the header is rendered twice, but overlaying each other slightly, if you zoom in on the header, it becomes one, like a normal heading on any website.
Has anyone else encountered this and know a solution? I've been at it for weeks can't find anything like it online.
Here is my site: http://cafe.cic.hull.ac.uk/~405851/
Thanks for any help.

Your problem seems similar to the one discussed and answered here: iOS 4.2+ webfont (ttf) 's bold font-weight rendering bug
Apparently one solution is to to change the inherited style via a font-weight:normal styling. This doesn't solve your issue if you feel that the text needs to be bold of course. You could try using different font weights as well.

Custom font rendering has had funky bugs in iOS for a while. In the iOS3 days, I was able to crash webkit itself with custom fonts. Good times.
So I would recommend using something like http://www.google.com/webfonts instead. The font files they serve are guaranteed to work well cross platform, and the stylesheet to include the fonts is tailored to the quirks of platform that requests it. They do a good job at avoiding font rendering bugs and cross platform inconsistencies.
For that reason, I would use Google WebFonts to serve any custom fonts if I had web content that needed to be shown consistently cross platform.
The tradeoff is that you don't get as much selection of fonts. But they do have a good amount, just not every font.

Related

How is styling of the UI for an IOS Apps done?

So with websites on the web we use HTML, CSS and Javascript.
What do we actually use to build the UI for an IOS App?
Is there a CSS/HTML/JS equivalent use for building IOS Apps?
What is the most common way use to design, style the UI of an IOS App?
The reason I ask is because I'm spending longer than expected learning core graphics and would like to move on with the book I'm studying from. I was under the impression core graphics was used for styling of apps and it was like an IOS equivalent of CSS.
Hoping someone could help clear things up thanks.
Regards
In many cases, images are used for styling in iOS.
For simple things like just changing background and text colors, UIView and its subclasses have direct accessors.
For most things, you won't need core graphics just for styling purposes. It would be easier to help you if we knew more concretely what you want to achieve, though.
The closest thing to a CSS equivalent is appearance proxies, which allow you to specify things like "all instances of UITextField should look have this font, colors and shadow when contained inside a NavigationController". You can override this for specific instances by just setting the desired values on the instance.

CSS drop shadow not showing on iPhone…?

I have a drop shadow on the animated buttons on my website which works fine across all browsers but it doesn't seem to be showing up on the iPhone... strange because it was showing a couple of days ago. Not exactly sure what I've changed to prevent it working.
Any pointers to what I've done wrong would be much appreciated!
I believe Older versions of safari need the -webkit-box-shadow since box-shadow was not fully supported. However it does work on the newest mobile safari
You will also run into problems with IE8 and IE7 using box-shadow. If I could recommend something (and I tend to do this), it is to make some images and use that as the background for those. It is a little bit of work but that is the safest route.

CTFontCreateWithName returning ".LastResort" font

I have multiple custom fonts provided with my app, all defined in the app's plist correctly. I can load UIFonts with those custom fonts with no problems. UILabels using [UIFont fontWithName:#"some-custom-font" size:14] as font work flawlessly.
What doesn't work is CoreText methods.
I need to use those fonts in attributed strings, so I absolutely need the CTFontRef. Till iOS 5 I had no problem what-so-ever. Now, CTFontCreateWithName tends to return a font called .LastResort, instead of what I need. If I kill the app and relaunch, some of the fonts that failed last time do work now, but others don't. Seemingly random. If I call CTFontCreateWithName immediately on app launch, that specific font works later, but again most of the others do not.
I never encountered this kind of behavior before. My app isn't very memory heavy. This feels like some iOS 5 bug. Any help or advice will be very welcome.
I've only used custom fonts via UIKit. You may want to contact DTS, or definitely bugreport.apple.com

Formatting text within UILabel differently

I'd like different words in a UILabel to be different colors. Does this mean each word will need to be a different UILabel? I'm guessing yes, though sure would be nice to just put color codes in the label somehow, you know? I guess I'm a bit spoiled by text markup in HTML.
There is no proper UIRichTextView in iOS. It's high on my wish-list for iOS 6 (and there's some reason to believe we may get it then due to the release of Pages).
Your options are to use multiple UILabel views, NSString UIKit Additions, Core Text, UIWebView, or one of a few third-party frameworks such as:
NSAttributedString-Additions-for-HTML
CoreTextWrapper
OHAttributedLabel
OmniUI
All of the current solutions have different problems. The most common problem is that it's hard to get select and copy functionality to work with rich text unless you use a web view. Web views are incredibly annoying because they're asynchronous and you have to do a lot of your interactions in JavaScript.
I wish there were a better answer.
(Obligatory shilling: This topic is covered in depth in Chapter 18 of iOS 5 Programming Pushing the Limits.)
UILabel doesn't support segmented formatting (the entire thing can only have one format).
Have a look at OHAttributedLabel, which does what you want.
As far as I'm aware you'd need to have separate labels for each different coloured word. Depending what you're trying to do you may be able to make use of myLabel.textColor to change the colour of the periodically or on events etc.

simple text editor for iPhone

Is there any simple text editor available for iphone having features like BOLD, ITALIC and changing colors and fonts? I want to add this functionality to my iphone app.
Any help will be really appreciated.
You have to develop it through Quartz2d.In otherwords ,you can through handling CGContext of UIView. see the Quartz2d programming guide.for example you can give bold font through
CGContextSelectFont (context,"Helvetica-Bold",12, kCGEncodingMacRoman);
Text Editor Pro seems to have those features. Pretty expensive though: http://itunes.apple.com/dk/app/text-editor-pro/id316815447?mt=8
Oliver Drobnik (aka Cocoanetics) is working on a rich text editor for iOS.
It won't be free, unfortunately. However, he has released a sizeable chunk of code that serves as the foundation of his rich editor here: https://github.com/Cocoanetics/NSAttributedString-Additions-for-HTML
It takes HTML and turns it into core text. A lot of hard work right there.
That, on its own, is not a rich editor, but like I said, it serves as the foundation of one. You could use it to write your own, if you don't want to pay up for Oliver's when he's finished. You can see what Oliver has been working on here: http://www.cocoanetics.com/2011/01/rich-text-editing-on-ios/