Tuesday, 7 August 2012

Five Tips for Creating Stylish UIButtons

Source: http://mobile.tutsplus.com

 

Project Preview

Project Demonstration

Project Setup

In the download that accompanies this tutorial, you’ll find folders entitled “Initial Build” and “Final Build”. Rather than showing all the steps necessary to setup the initial project, you should simply download the attachment and follow along using the project from the “Initial Build” folder.
With the initial project open, go to the ViewController.m file and locate the for loop within the viewDidLoad method. The code snippets from the tips below should be placed within this loop.

Tip #1: Tweak Colors & Gradients

The most fundamental step toward customizing the UIButton class is to adjust the color of the background and title for both the default and highlighted states. The following code snippet sets each button’s background color to black, normal title color to white, and highlighted title color to red:
1
2
3
4
5
6
// Set the button Text Color
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
         
// Set the button Background Color
[btn setBackgroundColor:[UIColor blackColor]];
Solid background colors are great, but a subtle gradient can often make the difference between bland and polished. Replace the setBackgroundColor: message above with the following to create a custom gradient:
1
2
3
4
5
6
7
8
// Draw a custom gradient
CAGradientLayer *btnGradient = [CAGradientLayer layer];
btnGradient.frame = btn.bounds;
btnGradient.colors = [NSArray arrayWithObjects:
                              (id)[[UIColor colorWithRed:102.0f / 255.0f green:102.0f / 255.0f blue:102.0f / 255.0f alpha:1.0f] CGColor],
                              (id)[[UIColor colorWithRed:51.0f / 255.0f green:51.0f / 255.0f blue:51.0f / 255.0f alpha:1.0f] CGColor],
                             nil];
[btn.layer insertSublayer:btnGradient atIndex:0];
Starting on line 4 above, an NSArray is created with the initial and target gradient colors. Note that the corresponding RGB values must be divided by 255 before being supplied to the colorWithRed:green:blue:alpha: message and that an alpha value of 1.0 represents fully opaque while an alpha value of 0.0 represents fully transparent. Unfortunately, a full explanation of the “magic” above is beyond the scope of this tutorial, but the important thing to remember is to that you simply need to replace the RGB values with the begin/end values you want to use in your own custom gradient.
If all went well, your menu should now look something like this:
Custom Color and Gradient
Not bad, huh? And we’ve only just begun. . .

Tip #2: Round the Corners

Next we want to add a custom corner radius to each UIButton in order to make things look a bit more sleek. Insert the following lines of code to make this happen:
1
2
3
4
// Round button corners
CALayer *btnLayer = [btn layer];
[btnLayer setMasksToBounds:YES];
[btnLayer setCornerRadius:5.0f];
In line 4 above the corner radius is set to 5.0. Play with this number to increase or decrease how noticeable the corners appear.
You should now have a menu that looks just a bit slicker:
Adding Corner Radius

Tip #3: Add a Stroke Border

Sometimes the small tweaks make all the difference. Add a 1px, black stroke around each button with the following lines of code:
1
2
3
// Apply a 1 pixel, black border
[btnLayer setBorderWidth:1.0f];
[btnLayer setBorderColor:[[UIColor blackColor] CGColor]]; 
Can you tell the difference? It’s very subtle, but still valuable:
Adding A 1px Border

Tip #4: Use a Custom Font

Now let’s try a more noteworthy tweak. The default system font just isn’t cutting it. The game menu we’re building needs a font that can match the visual aesthetic of the game. A quick search on Google Fonts reveals just a font called Knewave by Tyler Finck that should do the trick. Download Knewave now.
After downloading the Knewave-Regular.ttf file, you’ll need to drag it into the Project Navigator pane in Xcode to add it to your project. Next, open up the Info.plist file. Add a new property list row and type in “Fonts provided by application”. An array should be created automatically. Set the string associated with Item 0 to “Knewave-Regular.ttf”. Double check the name because the value is case sensitive. Save the file.
After making the above modification, your Info.plist file should now look like this:
Plist Entry
Next, you’ll need to add the Knewave-Regular.ttf file to your project’s bundled resources. Select “SleekButtons” from the Project Navigator and then click the “Build Phases” tab. Expand the “Copy Bundle Resources” drop down and then click the plus sign.
Adding to Bundled Resources
At this point, you should be able to begin using the Knewave font in your project! Let’s test that out by jumping back to the ViewController.m file and modifying the viewDidLoad method to set a custom font:
1
2
3
4
5
6
7
8
9
10
// Set the button Text Color
[btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
               
// Add Custom Font
[[btn titleLabel] setFont:[UIFont fontWithName:@"Knewave" size:18.0f]];
         
// Draw a custom gradient
CAGradientLayer *btnGradient = [CAGradientLayer layer];
btnGradient.frame = btn.bounds;
Notice that the fontWithName value is specified as “Knewave”, not “Knewave-Regular” as you might expect. This is because there is a difference between the font’s filename and the font’s given name. You’ll need to be sure you use the given name when working with your own fonts.
With the above code in place, the game menu should be complete! Build and run now and you should see something like the following:
Custom Fonts

Tip #5: Optional: Apply a Rotation

While not utilized in the primary design demonstrated by this tutorial, it’s often useful to apply a slight rotation to UIKit elements, particularly UIButton or UIImage objects. Doing so is simple, and can be done with just one line of code.
You can try this out with the code written so far by doing the following:
1
2
3
4
5
6
7
self.startGameButton.transform = CGAffineTransformMakeRotation(M_PI / 180 * 5.0f);
     
for(UIButton *btn in buttons)
{
    // Set the button Text Color
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
In line 1 above, the constant M_PI is divided by 180 to generate 1 radian, which is then multiplied by 5.0f to result in a rotation of 5 radians. As you will notice if you build and run the project, the above is likely to result in anti-aliasing problems with UIKit elements that are drawn dynamically. Consequently, applying a rotation is more appropriate with a UIButton when the background image property is set and raster graphics are in use (i.e. this works best with PNG files).

Bonus Tip: Use UIButton-Glossy

With the five tips above, you’ve seen how easy it can be to make subtle yet significant tweaks to a UIButton object. However, what if I told you that doing so could be even easier? Meet UIButton-Glossy, an open-source category by George McMullen that automatically applies both a gradient and a glossy finish to UIButton objects.
Implementing UIButton-Glossy in your own project is simple. After you’ve downloaded the UIButton-Glossy.h and UIButton-Glossy.m files and added them to your Xcode project, import the *.h file in the main project view controller, like this:
1
2
#import "ViewController.h"
#import "UIButton+Glossy.h"
Now you can instantly apply a cool glossy effect on your buttons with just one line of code: [btn makeGlossy];.
To see this in action, replace the existing view controller code with the following:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
for(UIButton *btn in buttons)
{
     // Set the button Text Color
    [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [btn setTitleColor:[UIColor redColor] forState:UIControlStateHighlighted];
         
    // Set default backgrond color
    [btn setBackgroundColor:[UIColor blackColor]];
         
    // Add Custom Font
    [[btn titleLabel] setFont:[UIFont fontWithName:@"Knewave" size:18.0f]];
         
    // Make glossy
    [btn makeGlossy];
}
Your buttons should now have a glossy finish and the end result should look something like this:
Glossy Finish

Saturday, 4 August 2012

10 Things You Never Knew About the Olympic Games


Today marks the Opening Ceremony of the 2012 Summer Olympic Games, and here at StumbleUpon, we couldn’t be more excited. Hopefully you’ve also been getting into the competitive spirit with our posts earlier this week on fitness myths and nutrition advice. We decided to honor today’s festivities with 10 unusual facts that you may or may not know about the Olympic Games, from the past to the present.
1. Every Olympics has an official mascot, and they’re not your typical eagles, tigers or bulldogs. In fact, most of them are rather odd. This year’s mascots, Wenlock and Mandeville, meant to represent the last drops of steel used to build the Olympic Stadium, are no exception.
2. Usain Bolt is a proud papa…to a cheetah! Bolt adopted an abandoned baby cheetah (fittingly named “Lightning Bolt”) in 2009, and continues to sponsor its care in an orphanage in Nairobi. Hmm…wonder who’s faster?
3. What do Giorgio Armani, Adidas and Stella McCartney have in common? They’ve all designed national team uniforms for the Opening Ceremony. Sporting everything from berets to fedoras, this year’s athletes will certainly be dressed to impress.
4. History will be made this year when double-amputee Oscar Pistorius runs for South Africa in the individual 400 meters and the 4×400 meter relay. Pistorius will be the first amputee ever to compete in track and field at the Olympics.
5. Hopefully he’ll fare better than Charles Hefferon, a fellow South African runner who competed in the Marathon in the 1908 Summer Olympics. Hefferon was in the lead until, with just a few miles to go, he drank a glass of champagne offered to him by a well-meaning fan. He promptly slowed down and was overtaken by other runners. Lesson learned: don’t drink and run!
6. The official song of London 2012 is “Survival,” by popular British band Muse. Check it out here (along with a cool montage video of Olympic athletes).
7. Are moustaches lucky? The night before his first race at the 1972 Olympic Games, legendary swimming champ Mark Spitz almost decided to shave off his famous moustache. However, a Russian coach started giving him a hard time about sporting facial hair, so Spitz joked that the moustache made him swim faster by keeping water away from his mouth. Spitz kept the ‘stache, went on to win 7 gold medals at the Games, and at the next Olympics, all the Russian swimmers were sporting moustaches.
8. The iconic Olympic rings were designed to symbolize the five inhabited continents of the world (Africa, Asia, Australia, Europe and the Americas), linked together by the Olympic spirit. At least one of the rings’ colors (blue, yellow, black, green and red, with a white background) are present in every participating country’s national flag.
9. The longest wrestling match of all time took place at the 1912 Stockholm Olympics, between Russia’s Martin Klein and Finland’s Alfred Asikainen. The match lasted a grueling 11 hours and 40 minutes! Klein eventually emerged the victor, but he was so drained from the fight that he was unable to compete for the gold medal the next day, and walked away with the silver.
10. You may still not know what the heck curling is, but that’s nothing compared to some of the very strange sports that have made it into the Olympics in the past. Our personal favorites? Definitely poodle clipping and delivery van driving.

Thursday, 28 June 2012

Majestic SEO Link Intelligence Tools

Updates to Majestic SEO

Majestic SEO have made some UItweeks to the look and style of our website. In addition our Fresh Index has enlarged to 145 billion urls. We feel that these updates will better explain our product offering than the previous layout. For more information on the layout updates, please head over to the blogpost regarding these updates.

 

Join us at the European Search Awards

You only have a day left to enter this! Majestic SEO are currently running a draw for one lucky person to join us in Amsterdam at the European Search Awards ceremony at the Majestic SEO table, to enjoy a fantastic meal on us. In addition those entrants who have either a gold, silver or platinum account at the draw time will also get to stay overnight at the Barbizone Palace. Already on the table with Dixon and Alex will be Joost, Wiep, Roy Huiskes and our key developers. To enter the competition, head over to our Facebookpage for all the terms and conditions.

 

Search Kingdom Podcast Show

In conjunction with WebMasterRadio, Majestic SEO have launched their own Podcast show. This show is recorded live at 5pm (UK time) every second or third Thursday of each month and will be broadcast on webmasterradio.fm/search-kingdom. Join Dixon Jones live on Thursday with special guest, Matt Roberts from Linkdex. 5:00PM London/9:00 AM PST.

 

Upcoming Webinar - How To Use Flow Metrics

For those of you who are still unsure as to how the Flow Metrics work, you won't want to miss out on the newest Majestic SEO webinar. The webinar entitled 'How To Use Flow Metrics' will be hosted by Dixon Jones. He will take you through exactly what the Flow Metrics are and exactly how they work. Tis webinar will be held on Thursday 28th June at 3:00pm London/7:00 AM PST. Register (no charge) here.

Saturday, 16 June 2012

Top Search Engine Ranks, Part 2- Mastering The Secret- Explained

by: John Krycek
 
In the first part of this series on ranking at the top of the search engines, we discussed diversifying your Internet marketing efforts. We introduced several methods including RSS feeds, Link Popularity, Article Marketing, Blogs, and physically altering your pages to make them more target-able for select keywords. All of these share the key of great content in order to unlock success.

Think of each method as a vehicle that carries the greatest cargo in the world. That cargo is your business, your product, and the word you want to get out.

Now....

So you're thinking, "show me how to set up these things and get traffic coming in!" We'll get to that, but imagine if you go to all the trouble of rewriting ten of your web pages, setting up a blog, writing some articles, buying some text links, syndicating your site over RSS, and you flip the switch and everyone hears you...

But then surprise! Your audience feels like they're watching an old, dubbed Karate movie... the words come in English three seconds after the guy moves his mouth...in Chinese. Your new parade of eager visitors turns away and never comes back.

Then you'd hate me, the Internet, your old first grade teacher... and we don't want that! So before we start adding marketing bells and whistles to your site, lets focus on the secret ingredient they all share, the solid foundation... super, juicy, colossal content! And, you can start drafting that immediately.

Great Content- What Makes It?

Is there a site you visit nearly every day? Why do you go there? Do you learn something or take back some knowledge? Guess what... the site has "good" content.

In terms of business, you're probably on the web researching, buying, or selling something. The Internet is all about information exchange. In whatever vehicle it's delivered to you, if the information is simple to find and well packaged in easy to understand, bite size pieces, you're happy. And you'll probably go back to the same place when you need more of that information.

In your case, content is information about/promoting/creating awareness about your business. To turn a new visitor into a new client or customer, you want to convey that information in a genuine, honest, no strings, down and dirty package.

So then, on the surface, your packaging should be:

-Professional
-Clean
-Attractive
-Interesting
-Simple
-Straight Forward
-Intriguing/Enticing

Let's take this article... the layout, wording, sentence structure, and my personality package the content. The content is the underlying message I want to share with you-- that all of the latest e-marketing techniques won't help you one bit if you don't understand the ideology behind them first, how they work, and how to adapt them to attract people to your own, unique piece of the Internet.

Great Content- How to write it

That's going to vary depending upon your audience. So let's start there! First, know who your audience is. Be yourself. If you are dishonest and pretend to be something you're not, it will show in time and you'll lose all the work you put in.

Which brings me to another important point. Write with confidence. If you are confident in what you are writing and you aren't attempting to deceive anyone (i.e. you are not selling seeds to an audience of botanists when your only skill is brick laying), you will earn people's respect.

Trust goes a long way. You don't have the luxury of delivering your content in person. You have a very short time to convince people you are not the latest scam, you have something to offer that will help them, and they can feel safe doing business with you or at least willing to learn more.

That's a pretty tall order! But you can do it. Let's start with some guidelines for writing your content. Remember... a web page, an RSS feed or a news article will all share these commonalities.

Great Content- Thematic Essentials

-Be informal, but structured

-Know your audience. Pretend you're talking to them. If you wouldn't say something in person, don't say it online.

-Don't be boring. Would you read what you've written?

-Do NOT lie

-Writing for the Net is not the same as writing for print

-Keep it simple- one idea at a time, don't overwhelm

-Inform, educate and show the reader what's in it for them.

-Do not saturate your content with sales hype. You are slowly building trust, making a name for yourself, and not producing an infomercial.

Great Content- Mechanical Essentials

-Divide your document into headings and sub points. People scan a page until something catches their eye, they don't read.

-Make your titles and headings catchy, yet poignant.

-Do not try to incorporate a keyword in every sentence. Be natural, your keywords and synonyms will enter themselves.

-Spell Check

-Grammar Check

-When finished, put your document down and go do something else. Come back later and revise. Repeat, rinse.

How to keep it fresh and keep your audience

-Earn their trust by being honest
-Identify with a common problem or solution to which all can relate
-Don't shove your product or service in their face
-Show them something cool
-Give them something they can try immediately
-Leave them wanting to come back

Concluding Thoughts...

Internet marketing takes time, perseverance, and practice. A ton of all three. If you are swamped with work and honestly can't commit, hire someone to help you or do it for you.

You wouldn't allow a brochure to be printed with spelling errors and bad photos. Your online presence is no different.

Now that you're working on writing, next time we'll learn how to encase your content in some of the latest Internet marketing methods. I'll show you how they really can increase links and get traffic flowing. In this series we'll delve into details about the pros and cons of each method, and how you can start using each right away to increase traffic and links. Start writing and revise, revise, revise! See ya soon!

Monday, 11 June 2012

Branding: You are the Brand

by: Daniel Sitter
 
What's in a brand name? Everything! Think of these brands: Coke, Barbie, Hershey, McDonalds, Madonna, Pepsi, Bono, Microsoft, Kleenex, Xerox, Steven Spielberg, Dell and GM. Did you notice that brands can be things, replicas of people and actual people? Brands are the public perception of a thing or person. Companies work very hard to establish their brand, sometimes failing when they attempt to tie a secondary product into the popular brand name. Does anyone even remember A1 chicken sauce?

The people and companies behind the above brand names are well known. They are established. They have earned the right to be positioned where they are in the public's eye. Are you or your product clearly associated with the solution you seek to provide? What about your product? What about your name? How are you positioned in the marketplace? As an entrepreneur, a small businessperson, you have to be ever so keenly aware of every minute detail and opportunity to brand yourself. You need to be the expert. Your product must solve the problem, and the world needs to know about it. Branding therefore, may be the most important marketing challenge you face as your business plan unfolds.

It's all about public perception. Is Coke the real thing? Does Hershey make the finest chocolate? Does McDonald's offer the best tasting, most nutritious hamburger? Does GM make the finest cars? We have been trained by skilled marketers to make the above associations. We have been conditioned over time to accept the advertising as real, whether we actually believe it or not. Very clever indeed, these markers have been. You cannot afford to be any less convincing in your efforts.

As CEO of your own organization, you will most likely not have the extensive resources that a major company or big name star has. You probably are the marketing department, the advertising department, the sales team, the accountant and so on. As such, you must remain acutely aware of your image, the perception of each and every customer, and to a great extent, the marketplace as a whole. Your position in the marketplace, often dictated by the perceived quality of your products, your celebrity, your reputation for service, your leadership in your field and your consistency will certainly have a great deal to do with the effectiveness of your brand. You are the brand.

As the brand, you must take the position that you will always be under scrutiny, under the microscope. Assume leadership. You may not be the biggest guy in your field, but through leadership you can establish a market presence that will help you to become positioned along with the major players in your market. Take the lead on local issues or take a stand on a national issue that relates to your product, service and market. Through association, you will be perceived as a market leader, regardless of your size. Attempt to resolve a small problem and associate it with a greater one and you will achieve a level of notoriety, one that you can leverage to increase your brand awareness.

Your company must be credible. That is to say that your products and services must do what you say they will. You must also be credible personally. If you cannot be rightfully associated with your product or service offering, it will be difficult for the public to be receptive to such a contradiction. Honesty and integrity will be assets of great value to you as your marketplace gets to know you.

You must be consistent. You must find your niche, take your stance, establish some position and build from it. If you change every week or every time a new wind blows, people will not take you seriously. They will begin to doubt your leadership and find it difficult to perceive you as a credible source for your goods and services. You will lose whatever market position you have gained and whatever leadership position that you have achieved by wobbling among various directions. The public sees consistency as strength and strength as character. When you are a small company, struggling to grow, the perception of you in the marketplace is a critical factor.

Your marketing plan should certainly include these concerns as well as the incredible importance of the awareness of your market image. Since you are the brand, few components within your business plan should receive more of your attention than the development of the public's perception of you, your evolving position in the marketplace and the development of your brand image.