Skip to content
Ider

沉淀我所学习,累积我所见闻,分享我所体验

Primary Navigation Menu
Menu
  • Home
  • About Ider
    • Who Ider?
    • Why Ider?
    • How Ider?
    • Where Ider?
    • What Ider?

Mobile Development(移动开发) (Page 3)

2014-03-31
31 March
On March 31, 2014
In Data Structures(数据结构), English Posts(英文写作), Language Tips(语言初试), Mobile Development(移动开发)

Introduction to Loc (Lua Objective-C)

Recently we were starting to use Lua in our game. Lua is a very popular scripting language in the game industry. It’s written in pure C and is very lightweight. We can simply add Lua source code to our project, and it is very easy to compile and run.

However, in practice we encountered issues with type conversion between Lua and Objective-C. In the beginning, we followed instructions to create C functions, and inside the functions we called Objective-C methods, then registered those functions into Lua State as library. When requirements went more complicated, we have to create a bunch of C functions, which are redundancy in a lot of places. This is really not an ideal to bridge between Lua and Objective-C.

After reading the Lua instructions for two days, and with knowledge about iOS7 JavaScript Framework, I decided to create a similar framework to handle type conversion between these two languages. The good thing is Objective-C is a superclass of C, and Lua is naturally compiled from C, this makes it very easy to construct a bridge and make them communicating with each other. With reflection from Objective-C, it’s also very convenient to call Objective-C methods from Lua.

Loc (Lua Objective-C) is the framework I created to convert type between Lua and Objective-C for our project. It’s as simple as Lua, with only 6 packages. It reduces a lot of time to create functions mapping Lua call, and it works pretty well so far.

With the permission from my company, I shared the slides that I presented to my colleagues about the design and syntax about Loc. I am trying to persuade my managers to make it open source, so more developers could use it to prove the usability and make the framework more mature.

2014-01-02
02 January
On January 2, 2014
In IT Products(数码产品), Mobile Development(移动开发)

利用Android的Tethering变手机为Wifi基站分享数据流量

网络现在似乎越来越成了马斯洛人类需求五层次理论之外的第六大更基本的需求,每个人手上的手机的电话功能变得越来越弱,数据流量变成了更加基本配置需要。家家户户也是牵入Wifi比牵入电视信号更重要。

HierarchyOfNeeds

平板电脑也越来越流行,但是一般只能链接Wifi,出了门连不上什么3G、4G也变成了一块只能砸人的砖头。要是想给平板配备数据流量,不仅设备上要付出额外的费用,平时有Wifi不常需要用到数据流量又变得很浪费。

这里跟大家分享个Android的功能,它可以让Android手机变成Wifi基站,让其它设备可以连接到手机上,使用该手机的数据流量。这样只要一部手机有数据流量,就能让家里其它设备在连不上Wifi的时候也能上网了。
Read More →

2013-11-04
04 November
On November 4, 2013
In Data Structures(数据结构), Knowledge Base(心得笔库), Language Tips(语言初试), Mobile Development(移动开发)

JavaScriptCore框架在iOS7中的对象交互和管理

之前一篇的文章中已经简单入门了iOS7中新加的JavaScriptCore框架的基本用法,十分的简单方便而且高效,不过也仅限于数值型、布尔型、字符串、数组等这些基础类型。本文将扩展到更复杂的类型,介绍一下该强大的框架是如何让Objective-C对象和JavaScript对象进行直接互通的。

为了方便起见,以下所有代码中的JSContext对象都会添加如下的log方法和eventHandler:

[codesyntax lang=”objc” lines=”normal”]

JSContext *context = [[JSContext alloc] init];
context.exceptionHandler = ^(JSContext *con, JSValue *exception) {
    NSLog(@"%@", exception);
    con.exception = exception;
};

context[@"log"] = ^() {
    NSArray *args = [JSContext currentArguments];
    for (id obj in args) {
        NSLog(@"%@",obj);
    }
};

[/codesyntax]
Read More →

2013-10-05
05 October
On October 5, 2013
In Design Patterns(设计模式), Language Tips(语言初试), Mobile Development(移动开发)

iOS7新JavaScriptCore框架入门介绍

前阵子,Apple正式发布了新的iOS 7系统,最大最直观的改变在于界面变得小清新范了,我也提到《iOS,你真的越来越像Android了》。不过对于移动开发者来说,除了要适应Xcode 5,最应该关注的还是iOS 7在开发接口的上的变化。概览Apple提供的官方文档《What’s New in iOS》,最最让我欣喜的是iOS 7中加入了JavaScriptCore框架。该框架让Objective-C和JavaScript代码直接的交互变得更加的简单方便。

JavaScriptCore

这个框架其实只是基于webkit中以C/C++实现的JavaScriptCore的一个包装,在旧版本iOS开发中,很多开发者也会自行将webkit的库引入项目编译使用。不过虽然iOS7把它当成了标准库,可惜目前,我还没有在Apple Developer中找到像之前文章中收集的那样的官方文档介绍这个框架的具体使用方法。

好在还可以在Xcode中找到头文件,而且里面的注释对每个类和方法的功能写得还算清楚,再结合网上仅有的几篇文章的介绍,我也在此简单入门一下JavaScriptCore。更多细节还待开发过程中发现。
Read More →

2013-06-13
13 June
On June 13, 2013
In Front Interface(界面构想), IT Products(数码产品), Mobile Development(移动开发)

iOS,你真的越来越像Android了

1-ios7-beta周一的苹果开发者大会上,Apple介绍了iOS 7的各种新的特性,虽然真正发布要到今年秋季,但是作为程序员的我们还是可以下载开发版本来亲身体验一番的。本来想下载更新到四代的iPod Touch上,但是似乎没有提供,所以只能跟同事借来一部iPone 5测试机更新到iOS 7。如果没有去年底对《Android 4.2新特性体验》,看到这一些新特性我一定会感到欣喜,但是现在体验的结果就跟看Keynote时是一样的:长得越来越像Android了。只能说有些东西就是先入为主了,做什么都应该抢个先(鲜)才行。
Read More →

2013-02-28
28 February
On February 28, 2013
In Article Collection(聚宝收藏), Mobile Development(移动开发)

iOS开发官方文档汇总

程序员的学习过程是无止境的,程序员学习的途径是多样的。可以从视频教程中领悟,也可以从他人的代码中理解。但当我们专注于某一个平台在开发的时候,对于某个API使用或者功能实现有疑问,通常简单的测试可以让我们知道可能的效果,异或网上搜索一下别人的经验,不过最好的途径应该还是阅读官方的文档解释。常常可以更全面,具体的了解。当然也不排除有时候官方文档说了跟没说似地,或者根本说得文不对题。

半年多里一直从事Mobile游戏的开发,Android和iOS平台都有接触,不过还是以iOS为主,为了解决问题也查阅了不少的文档资料。就像以前学.NET一定会去MSDN,iOS上的问题就会先去查阅Apple Developer。总得感觉Library的文档还是MSDN做得比较好,说明详细例子也比较多。而Apple Developer上对于API的注释都不够详细,而且没有例子告之该如何使用。

apple-pdf不过Apple的文档也有它独有的好处,比如绝大部分的文档都有相应的PDF格式文件提供下载,对于离线阅读十分的方便,而且还可以在PDF做一些相应的笔记,针对某几页进行打印等等。

另外,Apple还会给出该API所对应的框架结构使用的文档,其中会有一些代码例子。但是其实那些例子依然不够,还是需要到其它地方寻找。但是这些讲述结构的文档却是体现出API设计的来源,所以十分值得阅读,只是需要花时间了理解和消化。Read More →

2012-11-15
15 November
On November 15, 2012
In IT Products(数码产品), Mobile Development(移动开发)

Android 4.2新特性体验

昨晚在我的Galaxy Nexus和Motorola Xoom上得到系统更新的消息,可以把手机升级到了最新的4.2系统。记得两年前,我刚用Android系统的HTC Aria手机,那部的系统版本还只是2.1,而且两年里从来没有去升级也没有刷过机。因为不方便,现在Android的设备升级已经变得便捷。所以我也乐得去升级系统的版本。

经过一天在Nexus手机上的使用,感觉到新系统的更进一步提升的体验,但是也有一些变化让我不太能适应。
Read More →

2010-11-21
21 November
On November 21, 2010
In IT Products(数码产品), Mobile Development(移动开发)

Android手机之初体验

2010年6月,当Jobs在苹果“全球开发者大会”上向世人展示iPhone 4代的时候,我被它所吸引了。它外观要比iPhone 3GS好看很多,拥有了更多的新特性,比如Retina 显示屏、FaceTime可视电话、前置摄像头,还有iOS 4.0带来的多任务处理、创建文件夹。

因此我一直就像以后换新手机的时候就买一个iPhone 4吧。但是到了正真要换手机的时候,却没有选择iPhone,反而选择了Android系统的HTC Aria。这主要是从几个方面考虑:HTC价格便宜,差不多只要iPhone 4 16G的一半;我已经拥有了一个iPod Touch 3代,应该再感受一下新的事物;朋友全都买了iPhone,我想玩可以借他们的。Read More →

Posts pagination

Previous 1 2 3
Facebook
Twitter
LinkedIn
RSS
ZhiHu

Recent Posts

  • 三年居家工作感受
  • Pixel Watch智能手表和Pixel 5, 6 Pro 及 7 Pro手机
  • 我拥有过的无线耳机
  • 毕业工作一个月,我差点被开除
  • 我拥有过的移动硬盘
  • ProtoBuf 2.0 method count optimization for android development
  • 面过100场行为面试后

Categories

  • Algorithm Analysis(算法分析)
  • Article Collection(聚宝收藏)
  • Data Structures(数据结构)
  • Design Patterns(设计模式)
  • English Posts(英文写作)
  • Front Interface(界面构想)
  • IT Products(数码产品)
  • Knowledge Base(心得笔库)
  • Language Tips(语言初试)
  • Mathematical Theory(数学理论)
  • Mobile Development(移动开发)
  • Programming Life(程序人生)
  • Reading Notes(阅而后知)
  • Software Engineering(软件工程)
  • Special Tricks(奇技妙招)
  • Tangential Speech(漫话杂谈)

Tags

Aero Android API Bash Binary Search Bitwise Operation Book C/C++ Career Chrome Conference CSS Debug Device DOM Extension Framework Game Gradle Hearthstone HTML Initialization Intellij Interview iOS Java JavaScript jQuery Keyword Language Issues Mac Microsoft Mobile Modifier Objective-C PHP Principle Reference Regular Expression Static String Tools Tutorial UI XML

Blogroll

  • Ahmed's Blog
  • Gert Lombard's Blog
  • Gordon Luk
  • Jack & Allison
  • 开发部落

Archives

Designed using Chromatic. Powered by WordPress.