如题,theos tweek写界面很不方便,想用xib来做。
我试了theos 和 iosopendev 都没有搞定,
有经验的朋友,帮忙指点,谢谢!!
如题,theos tweek写界面很不方便,想用xib来做。
我试了theos 和 iosopendev 都没有搞定,
有经验的朋友,帮忙指点,谢谢!!
利用Theos部分提到的layout文件夹,在一个工程里打包一个tweak和一个App,其中tweak用Theos写,App用Xcode写就好了。这种工程架构可以参考SMSNinja
狗神,谢谢你!
按照你说的方法,现在tweek 和 app已经合并到一个*.deb文件中了。
app 我是用xcode写的,就像开发常规的app一样,所以可以用xib来写界面并能正常运行。
但tweek中要如何用xib写界面呢,你之前做过吗?谢谢!!!
你要达到什么目的?
因为我要写的tweek界面比较多,纯代码写起来速度慢。
我想在xib中拖控件和约束,特别是autolayout的约束在IB中速度快多了。
有界面的话,用App来承载不就可以了吗?
也就说界面和tweak是什么关系?
app的界面会列出手机上的全部app。通过一个操作会启动手机个的某个app,并把tweek注入到刚刚启动的app。
tweek和自己编写的app都有各自的界面,类似于“叉叉助手”。
如果是这样的话,tweak的界面不就是被注入App的界面吗?
嗯,是的。
现在tweek的界面可以显示在被注入的app中,这些都没有问题。
只不过tweek的界面都是纯代码写,我想换成xib的来写,这样速度快些。
用xib的话就不用写如下让人蛋疼的UI代码了。。。。
// add bgview
UIView *__bgView = [[UIView alloc] init];
self.bgView = __bgView;
[__bgView release];
self.bgView.translatesAutoresizingMaskIntoConstraints = NO;
self.bgView.backgroundColor = rgba(0, 0, 0, 0);
[self addSubview:_bgView];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"|[bgView]|"
options:0
metrics:nil
views:@{@"bgView" : self.bgView}]];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[bgView]|"
options:0
metrics:nil
views:@{@"bgView" : self.bgView}]];
// center contentview
[self.bgView addConstraint:[NSLayoutConstraint constraintWithItem:self.contentView
attribute:NSLayoutAttributeCenterY
relatedBy:NSLayoutRelationEqual
toItem:self.bgView
attribute:NSLayoutAttributeCenterY
multiplier:1.0
constant:0]];
[self.bgView addConstraint:[NSLayoutConstraint constraintWithItem:self.contentView
attribute:NSLayoutAttributeCenterX
relatedBy:NSLayoutRelationEqual
toItem:self.bgView
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:0]];
我有点糊涂了,在我的理解里,tweak是不需要界面的啊!界面全都交给App来展示不就可以了?