Coder Social home page Coder Social logo

rqshinelabel's People

Contributors

ddwang avatar dinggong avatar fel1x-developer avatar gktoken avatar lfarah avatar maxkonovalov avatar pauliusvindzigelskis avatar warpling avatar zipme 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

rqshinelabel's Issues

Repeat the shine with a button

I need to repeat the shine when the user touch on a UIButton. There is a way to reset the label to the initial state and then call the shine again?

How to implement this with swift?

Hi, I'd like to ask you how can I use this component with Swift? I'm not familiar with Objective C at all.

Especially lines:
self.shineLabel = [[RQShineLabel alloc] initWithFrame:CGRectMake(16, 16, 298, 300)];
and
[self.shineLabel shine];

Thank you

Edit:

Sorry with stupid question. Here is my solution:
Ad.1 self.shineLabel = RQShineLabel(frame: CGRectMake(16, 16, 298, 300))
Ad.2 self.shineLabel.shine()

Repeat the animation

Hello i want repeat this animation while calling an API. But it's not happening. Please suggest, how to handle it

Manual Installation

CocoaPods and Carthage are awesome tools and make our life really easier, but there are some devs who still don't know how to use them.

It would be cool to add the Manual installation guide in your README.md. You can take a look at my iOS Readme Template to see how you can do it.

Color of text?

I've been having trouble getting this to work with a black/dark colored text. I know RQShineLabel defaults to using a white text color, but does it currently support different color texts? If not has anyone forked this to support that?

Thanks.

trying to do animation after fadeout completion but not work.

I want to create the animation that the label shines first, then followed by fading out the text and then switching the image in an imageview and after the completion of switching image I want to shine some other text, and repeat this process forever. Yet I do not know why the completion block for fadeout is not called.
Here is some of my code:

  • (void)Animate
    {
    if (self.shineLabel.isVisible)
    {
    //NSLog(@"is visible");
    [self.shineLabel fadeOutWithCompletion:^{
    NSLog(@"text = %@",self.shineLabel.text);
    [self changeText];
    [self startAnimatingBackground];
    [self.shineLabel shineWithCompletion:^{
    [self Animate];
    }];
    //[self startAnimatingBackground];
    }];
    }
    else
    {
    [self.shineLabel shineWithCompletion:^{
    [self Animate];
    }];
    }
    }
  • (void)startAnimatingBackground
    {
    NSLog(@"start animating background");
    UIImage *image = [self.imageArray objectAtIndex:(count % [self.imageArray count])];
    [UIView transitionWithView:self.imageLayer1
    duration:2.0f
    options:UIViewAnimationOptionTransitionCrossDissolve
    animations:^{
    self.imageLayer1.image = image;
    }completion:^(BOOL finished)
    {
    NSLog(@"finished");
    count++;
    }];
    }

about memory handle

when you add this label in the controller, and push out then push back, loop this operation, the memory will rise up , what I should do at this time?

First Line Alignment Error

If you set the UILabel alignment to center or right with multiline text (2+ more lines) the first line is aligned to the left while the rest of the lines are aligned center or right.

fadeoutDuration

There is a property fadeoutDuration but doesn't have any impact on animation and it is not used anywhere in code. As a workaround I'm using shineDuration instead.

Positioning in Landscape causes issues

For some reason, in Landscape, the coordinates totally freak out. I can change it to (5, 5, 250, 500) and it will not appear where it should be, in fact, I can't even use negatives to get it to appear at the top. I'm attaching it to the subview of my overall view, so 0,0, should signify the top left, but no go. Still working on this, but I'm pretty sure it has to do with my app working in landscape and not portrait.

Edit: Just realized I complained without leaving anything positive: big thanks to the author for the control, it's super beautiful and exactly what I need for my project, I just have to get it to work :-)

found some bugs with _fadeoutDuration

I have tried to change the _fadeoutDuration from 2.5s to another value, but it doesn't work
I find that you made mistake in this function,

- (void)startAnimationWithDuration:(CFTimeInterval)duration
{
  self.beginTime = CACurrentMediaTime();
  self.endTime = self.beginTime + self.shineDuration;
  self.displaylink.paused = NO;
}

Maybe you should add duration rather than self.shineDuration
I fixed it but another bug happen, and I fixed it finally with inserting these code below into your updateAttributedString

  if (now > self.endTime) {
    self.displaylink.paused = YES;

      for (NSUInteger i = 0; i < self.attributedString.length; i++) {
          self.characterAnimationDelays[i] = @(arc4random_uniform(self.fadeoutDuration / 2 * 100) / 100.0);
          CGFloat remain = self.fadeoutDuration - [self.characterAnimationDelays[i] floatValue];
          self.characterAnimationDurations[i] = @(arc4random_uniform(remain * 100) / 100.0);
      }

    if (self.completion) {
      self.completion();
    }

You use self.shineDuration in setAttributedText, it will affect the fadeoutAnimation, I add those code to update characterAnimationDurations to get the right fadeoutAnimation. Need pull request? Hope you can understand my Chiglish :๏ผ‰

Not working with IBOutlets

Hello!

I love it, but I cannot use it by creating an UILabel with custom class RQShineLabel through an IBOutlet in my storyboard.

The only thing missing to work is to add the "awakeFromNib" function in the RQShineLabel implementation. I have added it and called [self commonInit] and it works perfectly, so if you wish, i think you can add that to be able to use it from storyboards or nibs :)

PS: I am someway new at developing with iOS, so my "solution" may not be the 'perfect one' (hell, it can be a total mess! :P) . I just know that an IBOutlet called from storyboards/nibs calls the "awakeFromNib" function, so I changed it in your code so I can use it 'not' programatically :)

Thanks for the code!!!

Here is a working SWIFT example: Auto change text with timer

Just wanted to put it out there in case anyone needs it. Here is a swift controller, and changes the text itself with a timer.

//
// IntroViewController.swift
//
// Created by Jason wang on 8/16/17.
//

import Foundation
import UIKit
import RQShineLabel
import Parse

class IntroViewController: UIViewController {
var shineLabel = RQShineLabel()
var timer = Timer()
var textArray = ["111", "222", "333"]
var currentCount = 0

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)
    
    self.shineLabel.shine()
}

var background1 = UIImageView()
var background2 = UIImageView()

override func viewDidLoad() {
    super.viewDidLoad()
    
    background1 = UIImageView(image: UIImage(named: "IntroBackground1")!)
    background1.contentMode = .scaleAspectFill
    background1.frame = self.view.bounds
    self.view.addSubview(background1)
    
    background2 = UIImageView(image: UIImage(named: "IntroBackground2")!)
    background2.contentMode = .scaleAspectFill
    background2.frame = self.view.bounds
    background2.alpha = 0
    self.view.addSubview(background2)
    
    self.shineLabel = RQShineLabel(frame: CGRect(x: 16, y: 16, width: 298, height: 300))
    self.shineLabel.numberOfLines = 0;
    self.shineLabel.text = "Welcome to my app"
    self.shineLabel.backgroundColor = UIColor.clear
    self.shineLabel.font = UIFont(name: "HelveticaNeue-Light", size: 18.0)
    self.shineLabel.center = self.view.center;
    self.view.addSubview(self.shineLabel)
    
    scheduledTimerWithTimeInterval()

    self.view.bringSubview(toFront: self.logo)
    self.view.bringSubview(toFront: self.loginView)
}

func scheduledTimerWithTimeInterval(){
    // Scheduling timer to Call the function "updateCounting" with the interval of 1 seconds
    timer = Timer.scheduledTimer(timeInterval: 8, target: self, selector: #selector(self.updateCounting), userInfo: nil, repeats: true)
}

func updateCounting(){
    if (self.shineLabel.isVisible) {
        self.shineLabel.fadeOut(completion: {
            let textIndex = self.currentCount % self.textArray.count
            let text = self.textArray[textIndex]
            self.shineLabel.text = text
            self.currentCount += 1
            UIView.animate(withDuration: 2.5, animations: {
                if (self.background1.alpha > 0.1) {
                    self.background1.alpha = 0;
                    self.background2.alpha = 1;
                }
                else {
                    self.background1.alpha = 1;
                    self.background2.alpha = 0;
                }
            })
            self.shineLabel.shine()
        })
    } else {
        self.shineLabel.shine()
    }
    
}

}

iOS8 issue

When the label is loading all of the text is compressed onto one line whilst animating, will then appear normal after animation completed.

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.