Giter Club home page Giter Club logo

yykit's People

Contributors

appriatt avatar cjsliuj avatar coderxwchu avatar draveness avatar evianzhow avatar faimin avatar huylenshu avatar ibireme avatar invokefear avatar jakelin avatar markrookie avatar philcai1993 avatar skyline75489 avatar stevemoser avatar wenchaod avatar windfringe avatar wintersone avatar yas375 avatar yinchengvy avatar zqpmaster avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yykit's Issues

YYTimer

define LOCK(...) dispatch_semaphore_signal(_lock); \ //这里应该是dispatch_semaphore_wait(_lock)??

VA_ARGS;
dispatch_semaphore_signal(_lock);

使用YYkeychain 取值的时候 崩溃

NSString *macCode=[YYKeychain getPasswordForService:@"123" account:@"YXmacCode" error:nil];
if (macCode==nil) {
    macCode=[NSString stringWithUUID];
    [YYKeychain setPassword:macCode forService:@"123" account:@"YXmacCode" error:nil];
}

在第一次运行的时候取空值是不报错的,再次运行取值就崩溃了

内存泄露

1ff75321-654d-4bc7-b4fc-c91a9d29bdef

前几天都没事,今天突然会发生内存泄露造成崩溃,分析了下在这行代码?用的是YYTextView。text为emoji表情。

宏定义求解答~~~

你好,这个宏有点疑问~

@weakify(nav);
#define weakify(object) autoreleasepool{} __weak __typeof__(object) weak##_##object = object;

1、前面的@有什么用啊?
2、还有宏中的debug时autoreleasepool{}和后面release时的try catch有什么区别?

问一个题外话

我看到Demo里边的布局是用Frame, 现在实际开发中你还会用frame吗, Autolayout呢?

裁剪圆角图片缓存后图片大小(非CGSize)变大的问题

你好,请问下 在Feed List Demo中Weibo中 缓存后的圆角头像的大小 比对应url的方形的头像图片的大小要大好几倍,这是UIImageJPEGRepresentation UIImagePNGRepresentation转data后缓存的原因吗?发现SDWebImage中也有这个问题 ,还是我用错呢? 望大牛指导下 3Q

建议框架里面的分类方法加个 yy 什么的前缀

目前之前SDWebImage 框架的分类方法也是像你目前这样,现在最新版本已经加入了前缀,避免跟系统或其他框架有冲突,有前缀兼容性更好。

例如:

  • (void)setImageWithURL:(NSURL *)imageURL placeholder:(UIImage *)placeholder;

改成:

  • (void)yy_setImageWithURL:(NSURL *)imageURL placeholder:(UIImage *)placeholder;

非常期待你的后续作品

阁下的东西是我看过国内干货最多的,太多值得我学习的。
非常期待大神的后续作品。

如果方便的话,可否认识下,希望在以后的开发过程中能得到指教。:)

关于动态图循环的疑问

如果动态图本身是无限循环的,播放(startAnimating)和停止(stopAnimating)是没有问题;
如果动态图本身就是循环有限次(3次),当循环停止后,再使用播放(startAnimating)没有作用;
怎样才能再次启动动态图的播放?
当然YYImage是非常好用的,假如你知道关于这方面的问题,请指教.谢谢!

好利害的YYKit

可以和MJ的系例比拼一下了,更难得的是po主英文还很厉害。
希望有机会可以为repo做供献。

忘了说了,什么时候出本书啊,讲讲你对ios的认识了解(比如优化性能的思路,算法什么的)。博客看完我还是不过瘾啊。

图片显示

在播放 PNG 图片的时候,在模拟器上能完整的显示出来,但在真机上的时候图片只停留在第一帧,请问是什么原因呢 ?模拟器和真机系统都是 9.2。就是下面这幅图
image

提个建议,webP动态图

在使用webP动态图的时候,可不可以把
uint32_t webpLoopCount = WebPDemuxGetI(demuxer, WEBP_FF_LOOP_COUNT);
播放的次数作为一个接口开放出来,可以任意修改,而不是默认读取webP动图本身的循环次数,这样在很大程度上会方便很多.

关于lldb调试

请问在断点调试时提示编译被优化,那断点调试或者lldb是否不可用?

An question about YYAnimatedImageView.m

I have read the code of YYAnimatedImageView.m. There is a question about code below.
image

Why should you remove value to the key ( @(nextIndex) ) in the buffer ?

[YYModel] usage: modelCustomTransformFromDictionary returns void instead of BOOL

From WBEmoticonGroup:

- (void)modelCustomTransformFromDictionary:(NSDictionary *)dic {
    [_emoticons enumerateObjectsUsingBlock:^(WBEmoticon *emoticon, NSUInteger idx, BOOL *stop) {
        emoticon.group = self;
    }];
}

This returns void instead of BOOL. On iOS6 the return value seems to be considered as NO, which is more reasonable in my perspective, causing crash when entering emoticon panel.

However, on iOS7 and above void seems to be treated as YES and the code works. Is this by design or something?

pod使用问题

发现只集成YYKit还不够,其它的库都是独立的
YYKeyboardManager
YYDispatchQueuePool
YYAsyncLayer
上面三个库用pod search的结果都是unable to find
用的CocoaPods版本是0.39.0,应该是最新的吧,怎么还search不到呢?

dispatch_async的block里面需要__weak self 吗?

YYKit的代码: (YYDiskCache.m)

  • (void)_trimInBackground {
    __weak typeof(self) _self = self;
    dispatch_async(_queue, ^{
    __strong typeof(_self) self = _self;
    if (!self) return;
    dispatch_semaphore_wait(self->_lock, DISPATCH_TIME_FOREVER);
    [self _trimToCost:self.costLimit];
    [self _trimToCount:self.countLimit];
    [self _trimToAge:self.ageLimit];
    [self _trimToFreeDiskSpace:self.freeDiskSpaceLimit];
    dispatch_semaphore_signal(self->_lock);
    });
    }

看下dispatch_async官方文档说明:

  • @param block
  • The block to submit to the target dispatch queue. This function performs
  • Block_copy() and Block_release() on behalf of callers.
  • The result of passing NULL in this parameter is undefined.

block参数系统会自动调用copy,保证self不被释放,在block执行结束后会release。所以没必要传__weak self。 如果传__weak self,就无法保证block在执行时,self是否被释放,反而会出现错误。所以不能传__weak self。

dispatch_async_on_main_queue 貌似不是异步

static inline void dispatch_async_on_main_queue(void (^block)()) {
if (pthread_main_np()) {
block(); // 直接执行算同步吧?
} else {
dispatch_async(dispatch_get_main_queue(), block);
}
}

Masonry和YYKit 不兼容

同时集成Masonry和YYKit
举例:Masonry 中的类似以下代码make.left.equalTo(_testView2.right) 一句会导致Masonry报 attempting to add unsupported attribute错

[_testView makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(_container);
make.left.equalTo(_testView2.right).offset(5);
make.width.equalTo(120);
make.height.equalTo(32);
}];

could not build module 'YYKit'

使用carthage编译生成的framework,拖到工程里,然后#import <YYKit/YYKit.h>
编译报错 could not build module 'YYKit'
error: unknown type name 'FOUNDATION_EXPORT'
FOUNDATION_EXPORT double YYKitVersionNumber;

请问怎么解决呀?

YYTransaction

YYTransaction 头文件描述是
YYTransaction let you perform a selector once before current runloop sleep.
但是YYTransactionSetup()实现是:CFRunLoopRef runloop = CFRunLoopGetMain();

YYLabel使用好繁琐

YYLabel使用好繁琐,
YYTextContainer *container = [YYTextContainer containerWithSize:CGSizeMake(self.frameModel.nameF.size.width, self.frameModel.nameF.size.height)];
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:self.frameModel.newsModel.nickname];
YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];
self.nameLabel.textLayout = layout;

界面没有显示,请教是怎么回事?

提个建议

我在项目中同时导入了 YYWebImage 、YYCache、YYImage。
一开是我在不知道YYWebImage是包含了其他2个库的
结果我在podfile文件同时引用了这个3个库。冲突了,文件重了!
那可以不可以 用 dependency 的方式去引用 YYCache、YYImage
s.dependency 'YYCache'
s.dependency 'YYImage'

在swift项目中使用

在swift项目中。按照 『手动安装』 中的步骤把YYKit加入项目中,并且在oc桥接文件中 import "YYKit.h" ,但是在项目中还是不能调用YYKit,请问,在swift项目中还需要做什么步骤吗~

使用UIButton+YYWebImage做缓存时会出现白色图片情况

[button setImageWithURL:[NSURL URLWithString:mediaLink] forState:UIControlStateNormal placeholder:[[WeTheme instance] emptyComicSquare] options:YYWebImageOptionProgressive |YYWebImageOptionSetImageWithFadeAnimation completion: nil]; 使用这样的代码加载button的图片,缓存失败的话会被白色图片替代。

手动导入后报错

你好,我手动导入的yykit这个框架,但不知道为什么会报这样的错误,不应该使用下面的双引号导入的方式吗
2016-01-04 12 34 40

是否有方法可以获取到设备当前的网速?

是否有方法可以获取到设备当前的网速?即上传速度和下载速度?希望添加到UIDevice+YYAdd的#pragma mark - Network Information 中,谢谢!(除了真的用一个测试文件上传/下载,然后体积/用时的这种方法外)

图片切圆角

imageByRoundCornerRadius UIImage+YYadd里的这个方法,不能把非等宽登高的图片切成圆的,有没有什么方法可以切成圆的?

Date的isLeapYear实现貌似有问题

闰年计算方法:
1、年份能被4整除;
2、年份若是100的整数倍的话,需被400整除,否则是平年。

但是实现是

  • (BOOL)isLeapYear {
    NSUInteger year = self.year;
    return ((year % 400 == 0) || (year % 100 == 0) || (year % 4 == 0));
    }
    从代码上来看, 被400整除或被100整除或被4整除都行,
    总体上而言, 就是被4整除即可.

闰年判断有误

- (BOOL)isLeapYear {
    NSUInteger year = self.year;
    if ((year % 400 == 0) || (year % 100 == 0) || (year % 4 == 0)) return YES;
    return NO;
}

西元年份除以400可整除,为闰年。
西元年份除以4可整除但除以100不可整除,为闰年。

模型转json对象的过程

ModelToJSONObjectRecursive中当模型为不合法的字典或者数组时,会对他使用可变的字典或数组进行重新构建,但是在返回结果中没用对其进行copy,这样是否会过分解耦数据,让使用者直接操作修改内部存放的容器?还是为了性能考虑没有进行copy?

一个注释上的小错误

一个注释上的小错误
YYKitMacro.h中 第237行,对 YYCompileTime 的注视说明中,类型应该为NSDate,现在是NSData

emoj 表情不显示

if (!_chatContentLabel) {

            _chatContentLabel = [YYLabel new];

            _chatContentLabel.frame = CGRectMake(70, 36, kScreenWidth-85, 22);

            _chatContentLabel.displaysAsynchronously = YES;

            _chatContentLabel.ignoreCommonProperties = YES;

            _chatContentLabel.textVerticalAlignment = YYTextVerticalAlignmentCenter;

            _chatContentLabel.backgroundColor = [UIColor redColor];

            [self.contentView addSubview:_chatContentLabel];
        }

        _chatContentLabel.hidden = NO;

        NSMutableAttributedString *text = [self attributeTextWith:_hisfieds.content];

        YYTextContainer *container = [YYTextContainer new];

        container.size = CGSizeMake(CGRectGetWidth(_chatContentLabel.frame), 22);

        container.maximumNumberOfRows = 1;

        YYTextLayout *layout = [YYTextLayout layoutWithContainer:container text:text];


        _chatContentLabel.textLayout = layout;

我这样写的,emoji表情不显示,哪里写的不对吗??

非技术性建议

阅读起来,前一种直观。写起来,后一种省事。

  • (NSString *)md5String {
    unsigned char result[CC_MD5_DIGEST_LENGTH];
    CC_MD5(self.bytes, (CC_LONG)self.length, result);
    return [NSString stringWithFormat:
    @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
    result[0], result[1], result[2], result[3],
    result[4], result[5], result[6], result[7],
    result[8], result[9], result[10], result[11],
    result[12], result[13], result[14], result[15]
    ];
    }

//- (NSString *)md5String
//{
// unsigned char result[CC_MD5_DIGEST_LENGTH];
// CC_MD5(self.bytes, (CC_LONG)self.length, result);
// NSMutableString *hash = [NSMutableString string];
// for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
// [hash appendFormat:@"%02x", result[i]];
// }
// return hash;
//}

运行demo的时候运行自定义shell脚本出问题

`PhaseScriptExecution Run\ Script /Users/chaoyang/Library/Developer/Xcode/DerivedData/YYKit-Static-dgprtydmnneatjaxszjjpuyeiyso/Build/Intermediates/YYKit-Static.build/Debug-iphoneos/YYKit.build/Script-D9B2622F1BEF581D0038C00A.sh
cd /Users/chaoyang/Desktop/IOS/库文件/YYKit-master/Framework
/bin/sh -c /Users/chaoyang/Library/Developer/Xcode/DerivedData/YYKit-Static-dgprtydmnneatjaxszjjpuyeiyso/Build/Intermediates/YYKit-Static.build/Debug-iphoneos/YYKit.build/Script-D9B2622F1BEF581D0038C00A.sh

UFW (M iphoneos): ERROR: Build failed
Traceback (most recent call last):
File "/Users/chaoyang/Library/Developer/Xcode/DerivedData/YYKit-Static-dgprtydmnneatjaxszjjpuyeiyso/Build/Intermediates/YYKit-Static.build/Debug-iphoneos/YYKit.build/Script-D9B2622F1BEF581D0038C00A.sh", line 812, in
run_build()
File "/Users/chaoyang/Library/Developer/Xcode/DerivedData/YYKit-Static-dgprtydmnneatjaxszjjpuyeiyso/Build/Intermediates/YYKit-Static.build/Debug-iphoneos/YYKit.build/Script-D9B2622F1BEF581D0038C00A.sh", line 745, in run_build
project = Project(os.path.join(os.environ['PROJECT_FILE_PATH'], "project.pbxproj"))
File "/Users/chaoyang/Library/Developer/Xcode/DerivedData/YYKit-Static-dgprtydmnneatjaxszjjpuyeiyso/Build/Intermediates/YYKit-Static.build/Debug-iphoneos/YYKit.build/Script-D9B2622F1BEF581D0038C00A.sh", line 201, in init
self.header_paths = [os.path.join(*x['pathComponents']) for x in self.public_headers]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/posixpath.py", line 73, in join
path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 28: ordinal not in range(128)
Command /bin/sh failed with exit code 1`
不知道啥原因。。。

编译报错

我是将YYKit下载下来,将YYKit文件夹加入到项目中,编译后UIDevice+YYAdd.h出现错误

xcode6无法编译

  • (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

(NSSet<UITouch *> *)这样的用法,导致xcode6无法打开……

非方形头像圆角显示问题

感觉代码中的圆角设置在非方形图片时有问题,从这里提取了关键代码做了一个简单的测试:

    UIImageView *_avatarView = [UIImageView new];
    _avatarView.size = CGSizeMake(40, 40);
    _avatarView.origin = CGPointMake(160, kWBCellPadding + 3);
    _avatarView.contentMode = UIViewContentModeScaleAspectFill;
    //    _avatarView.clipsToBounds = YES;
    [self.view addSubview:_avatarView];  //注意这里是self.view
    CALayer *avatarBorder = [CALayer layer];

    avatarBorder.frame = _avatarView.bounds;
    avatarBorder.borderWidth = CGFloatFromPixel(1);
    avatarBorder.borderColor = [UIColor colorWithWhite:0.000 alpha:0.090].CGColor;
    avatarBorder.cornerRadius = _avatarView.height / 2;
    avatarBorder.shouldRasterize = YES;
    avatarBorder.rasterizationScale = kScreenScale;
//    [avatarBorder setMasksToBounds:YES];
    [_avatarView.layer addSublayer:avatarBorder];

    [_avatarView setImageWithURL:[NSURL URLWithString:@"http://pic.qiushibaike.com/system/avtnew/1448/14486583/medium/20140311151742.jpg"] //profileImageURL
                                 placeholder:[UIImage imageNamed:@"defaultLogo"]
                                     options:kNilOptions
                                     manager:[QBStatusHelper avatarImageManager] //< 圆角头像manager,内置圆角处理
                                    progress:nil
                                   transform:nil
                                  completion:nil];

图像原图为:
test

上面的代码显示效果:
2016-01-02 12 11 50

我想这是_avatarView.clipsToBounds未设置为YES的原因,把上面代码中的第一个注释去掉,再运行显示效果如下:
2016-01-02 12 15 07
可以看到现在是显示方形了,但是圆角没有了。我想这是圆角在frame之外被clip掉了?把上面代码中的第二个注释去掉也是一样的结果。

我更大的疑问是avatarBorder明明被设置了frame.size为(40,40),为什么addSublayer之后没有遵守这个size呢?求解惑

这里是为了适配iOS9的initWithFrame:的吗?

- (instancetype)initWithFrame:(CGRect)frame {
    if (frame.size.width == 0 && frame.size.height == 0) {  // 你好,我问一下这里的代码是为了适配iOS9frame初始化的吗?
        frame.size = kSize;
    }
    self = [super initWithFrame:frame];
    // initFrame code
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.