利用摄像头判断手机移动方向[MPMotionPattern]

这部分代码是做原型用的,现在已经不在项目里。
也没有什么特别的算法,所以就放在这里吧。
https://github.com/pppoe/MPMotionPattern

需要用到之前的“iOS逐帧处理录像-MPVideoProcessor”
主要的算法是从TinyMotion这个项[......]

Read more

[iOS]delegate和protocol

今天上班和同事讨论工程怎么组织的时候涉及到这个话题。
iOS开发上对delegate使用广泛。
记在这里,如果有新人Google到了,希望能有点帮助。

protocol和delegate完全不是一回事,放在一起说,只是因为我们经常在同一个头文件里看到这两个word。

protocol[......]

Read more

贝塞尔曲线拟合

接上一篇Blog,这里用贝塞尔曲线来平滑多个点。

和样条插值不同,在多个点上作贝塞尔曲线的时候,曲线只穿过首尾两个点,中间的点都是作为控制点。

移动控制点,曲线也随之形变,可以造成一种拉扯的效果。在各种作图工具中,经常使用贝塞尔曲线来画曲线。一般的操作都是先画一条线段,然后可以通过拖动一[......]

Read more

UITableViewCell的背景

Saved Blog

UITableViewCell是一个很常用的View,通常我们都是直接使用它。

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 
    static NSString *cellIdentifier = @"CellIdentifier";
 
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell)
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier] autorelease];
    }
 
    cell.textLabel.text = [NSString stringWithFormat:@"Line: %d", indexPath.row];
 
    return cell;
}

得到这个效果:

现在我们给tableViewCell加上点背景色:

b526fbfb61[......]

Read more