gpt4 book ai didi

ios - Appcelerator IOS模块开发

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:33:22 25 4
gpt4 key购买 nike

我在尝试为 Titanium/Appc 创建一个 IOS 模块时遇到了困难,我正在尝试集成 https://github.com/antiguab/BAFluidView所以我可以在钛中使用它。

我已经按照模块教程进行操作,它只在标准 View 下工作正常,但是当我尝试添加 BAFluidView 时,它不起作用。

我已将这些类包含在 xcode 中并具有以下代码。

#import "ComExampleFluidView.h"
#import "TiUtils.h"
#import "BAFluidView.h"
#import "UIColor+ColorWithHex.h"

@implementation ComExampleFluidView
- (void)initializeState
{
// Creates and keeps a reference to the view upon initialization
square = [[UIView alloc] initWithFrame:[self frame]];

BAFluidView *view = [[BAFluidView alloc] initWithFrame:view.frame];
[view fillTo:@1.0];
view.fillColor = [UIColor colorWithHex:0x397ebe];
[view startAnimation];
[square addSubview:view];

[self addSubview:square];
[super initializeState];
}
-(void)dealloc
{
// Deallocates the view
RELEASE_TO_NIL(square);
[super dealloc];
}
-(void)frameSizeChanged:(CGRect)frame bounds:(CGRect)bounds
{
// Sets the size and position of the view
[TiUtils setView:square positionRect:bounds];
}
-(void)setColor_:(id)color
{
// Assigns the view's background color
square.backgroundColor = [[TiUtils colorValue:color] _color];
}
@end

头文件是

#import "TiUIView.h"
@interface ComExampleFluidView: TiUIView {
UIView *square;
}
@end

有人可以对此提出一些建议吗?

最佳答案

由于您正在尝试桥接原生 View ,因此您需要一些布局助手来正确处理 Titanium 布局系统。请检查类似 ti.googlemaps 的模块,尤其是 initialization意见。此外,您的自定义 setter (如 setColor)需要将颜色应用到您的 BAFluidView,而不是您的 UIView,因此您需要保留一个引用你的标题里面的那个。我想 ti.googlemaps 示例应该解释您正在寻找的所有概念。祝你好运!

关于ios - Appcelerator IOS模块开发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37139858/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com