Pixate是一个框架使用CSS样式本地组件

http://www.pixate.com/docs/framework/ios/2.0/getting-started/

Pixate是一个框架使用CSS样式本地组件。 它提供了简单性和灵活性的CSS样式相同的本地iOS组件附带XCode。

Pixate不是一个web框架 。 如果您已经熟悉使用CSS的网页,你会感觉像在家里一样Pixate使用。 如果你从未使用CSS之前,请相信我们,这将使前端开发变得容易很多。

这 五分钟的指导 将告诉你如何得到工作在你的Pixate XCode项目,使用CSS样式本地组件。

Getting Started with Pixate

Pixate is a framework for styling native components using CSS. It provides the simplicity and flexibility of CSS to style the same native iOS components that ship with XCode.

Pixate is not a web framework. If you're already familiar with using CSS on the web, you're going to feel right at home using Pixate. If you've never used CSS before, trust us, this is going to make front end development a lot easier.

This five-minute guide will show you how to get Pixate working inside of your XCode project, and styling native components using CSS.

Installation

If you haven't already download Pixate. Then, copy the Pixate folder to a convenient location.

App Setup

Here's how to get Pixate working in your native iOS app. There are three steps:

1. Add Pixate to your XCode project.

First, start a new project in XCode. Configure it however you like.

New Xcode Project

Then, add Pixate.framework to the frameworks folder of your project and add -ObjC to the Other Linker Flagsin Build Settings.

2. Add the Linked Libraries that Pixate needs.

Before you use Pixate, CoreText.framework and QuartzCore.framework need to be added to your project.

3. Insert Pixate calls introduction source files.

To enable the Pixate Engine in your app, you'll need to set the styleMode of your app's window and call the Pixate initializer, passing it your license key and username.

In AppDelegate.m, add an #import statement and this styleMode call.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  <em>...your other code here...</em>

  //Must go above makeKeyAndVisible call, if it's there.
  <strong>self.window.styleMode = PXStylingNormal;</strong>

  [self.window makeKeyAndVisible]; // &lt;-- This line won't be here,
                                   //     if you're using storyboards.

  return YES;
}

Note: If you are using storyboards, you will not have the makeKeyAndVisible call. Simply place the styleMode call right before return YES;.

In main.m, add this Pixate call, with your license information.
#import <UIKit/UIKit.h>;
#import <Pixate/Pixate.h>;

#import "AppDelegate.h"

int main(int argc, char *argv[])
{
  @autoreleasepool {
      [Pixate licenseKey:@"YOUR LICENSE KEY" forUser:@"YOUR USER NAME"];
      return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
  }
}

Note: Pixate will still work without a License Key. If you haven't entered your key, a splash screen will appear every time your app launches.

CSS in your Native App

Let's make a simple app that styles a button using Pixate. We're going to make a green button, on a white background using this CSS:

view {
  background-color: #ffffff
}

.btn-green {
  color            : #446620;
  background-color : linear-gradient(#87c44a, #b4da77);
  border-width     : 1px;
  border-color     : #84a254;
  border-style     : solid;
  border-radius    : 10px;
  font-size        : 13px;
}

Congratulations! You are now using CSS to style a native application.

Now what?

Now that you understand the basics of using Pixate, it might be a good time to check out the docs, which cover how to use Pixate for other native components.

It's worth noting that, while Pixate uses the same CSS syntax as the web, it does not use all of the same property names as the web does. Native apps have different properties, and so does our CSS.

If you're new to CSSthis guide by Code Academy is a good place to start.

And of course, if you have any questions, you can always get them answered by Pixate engineers and the Pixate community at answers.pixate.com.

Happy coding!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值