×

performselector select th

ios performselector:withobject:withobject:怎么解决?js怎么动态改变style里面的border-bottom,width的值

admin admin 发表于2022-06-12 14:21:07 浏览135 评论0

抢沙发发表评论

ios performselector:withobject:withobject:怎么解决


必须保证调用performSelector:withObject:afterDelay:是在主线程中。

但没有测试在子线程中再创建个NSTimer用来延迟,应该也可以,反正直接用[NSTimer timerWithTimeInterval:invocation:repeats:]是不行的。

特实现
- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay
方法,保证在主线程中调用成功

// NSObject_performSelectorEx.h
@interface NSObject (performSelectorEx)
- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay;
@end
// NSObject_performSelectorEx.m
#import “NSObject_performSelectorEx.h“

@implementation NSObject (performSelectorEx)

- (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay
{
NSMethodSignature *sig = [self methodSignatureForSelector:aSelector];
if (!sig)
{
return;
}

NSInvocation *invo = [NSInvocation invocationWithMethodSignature:sig];
[invo setTarget:self];
[invo setSelector:aSelector];
[invo setArgument:&anArgument atIndex:2];
[invo retainArguments];

NSMethodSignature *sigMT = [invo methodSignatureForSelector:@selector(performSelector:withObject:afterDelay:)];
NSInvocation *invoMT = [NSInvocation invocationWithMethodSignature:sigMT];
[invoMT setTarget:invo];
[invoMT setSelector:@selector(performSelector:withObject:afterDelay:)];
SEL arg1 = @selector(invoke);
void *arg2 = nil;
NSTimeInterval arg3 = delay;
[invoMT setArgument:&arg1 atIndex:2];
[invoMT setArgument:&arg2 atIndex:3];
[invoMT setArgument:&arg3 atIndex:4];
[invoMT retainArguments];

[invoMT performSelectorOnMainThread:@selector(invoke) withObject:nil waitUntilDone:NO];
}

@end

js怎么动态改变style里面的border-bottom,width的值


1、首先需要获取到相应的元素,这样才能改变他的样式。获取方法可以通过getElementByID(),除了 getElementById() 之外,还有 getElementsByName() 和 getElementsByTagName()。参考:比如你将获取到的元素赋值给了变量a,那么修改该元素的border-bottom就是:

a.style.borderBottom=“20px“;

width就是:

a.style.width=“200px“;

thinkpad为什么UEFI/Legacy Boot-CSM Support后面的怎么设置啊


1、开机按F1或Fn+F1进bios后,把security--security
boot状态改为disable(默认为enable)。
2、按esc回到bios初始画面,选startup,把startup选项下边的uefi/legacy
boot
状态改为both或者legacy
only(默认是uefi
only).改完后按F10保存退出。
3、重新开机按F12选usb引导或者光盘引导,安装win7就可以了。
你要先把security
boot的状态改了才可以设置uefi的。
-select