0
나는 동작이있는 단추를 만드는 정적 void가 있습니다. 또한 정적 void가되도록 작업을 원하지만 패키지를 만들려고 할 때 오류가 발생합니다.IBAction in theos에서 정적 void로
코드 :
typedef enum {
SBIconLocationHomeScreen = 0,
SBIconLocationDock = 1,
SBIconLocationSwithcer = 2
} SBIconLocation;
static UIButton *okbtn;
@interface SBApplicationIcon
- (void)launchFromLocation:(SBIconLocation)location context:(id)arg2;
@end
static void AddBtn()
{
UIWindow *window = [[UIApplication sharedApplication] keyWindow];
okbtn = [UIButton buttonWithType:UIButtonTypeCustom];
[okbtn addTarget:window action:@selector(checkpw:) forControlEvents:UIControlEventTouchUpInside];
[okbtn setTitle:@"Done" forState:UIControlStateNormal];
[okbtn setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
okbtn.frame = CGRectMake(0, 0, 160, 40);
okbtn.translatesAutoresizingMaskIntoConstraints = NO;
[UIView transitionWithView:window duration:0.4 options:UIViewAnimationOptionTransitionCrossDissolve animations:^{
[window addSubview:okbtn];
} completion:nil];
[window addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat:@"V:|-255-[okbtn(40)]"
options:NSLayoutFormatDirectionLeadingToTrailing
metrics:nil
views:NSDictionaryOfVariableBindings(okbtn)]];
[window addConstraints:[NSLayoutConstraint
constraintsWithVisualFormat:@"H:[okbtn(160)]"
options:0
metrics:nil
views:NSDictionaryOfVariableBindings(okbtn)]];
[window addConstraint:[NSLayoutConstraint
constraintWithItem:okbtn attribute:NSLayoutAttributeCenterX relatedBy:NSLayoutRelationEqual toItem:window attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:0.0]];
}
static void checkpw()
{
//Something
}
%hook SBApplicationIcon
- (void)launchFromLocation:(SBIconLocation)location context:(id)arg2
{
AddBtn();
}
%end
오류 :
Tweak.xm:43:13: error: unused function 'checkpw' [-Werror,-Wunused-function]
static void checkpw()
내가 그것을 어떻게 해결할 수 있습니까?
질문에 실제 코드와 함께 실제 코드를 포함 시키십시오. 필수적으로 외부 사이트에 링크하지 마십시오. 함유량. – luk2302