Code Monkey home page Code Monkey logo

ltmorphinglabel's Introduction

ltmorphinglabel's People

Contributors

0xleif avatar afdreher avatar aske0115 avatar biku avatar dustfire avatar fabi755 avatar jadar avatar jeehut avatar jonathanwuki avatar jonicong avatar kaishin-r avatar lexrus avatar mofneko avatar muhammadbassio avatar nobre84 avatar pahmed avatar prscx avatar rivera-ernesto avatar sjrmanning avatar tstanik avatar wh1100717 avatar yonaskolb 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

ltmorphinglabel's Issues

Should LTMorphingEffect's allValues be public?

Maybe I can't use allValues in LTMorphingEffect. Should this be public?

@objc public enum LTMorphingEffect: Int, Printable {
    ...    
    static let allValues = ["Scale", "Evaporate", "Fall", "Pixelate", "Sparkle", "Burn", "Anvil"]
    ...
}

Build Error

Hi.

I tried this library, but happened build error.
Do you have a good idea for you to solve this problem?

Th error message is

error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: unknown option character `X' in: -Xlinker
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]

The Trace Message is

Libtool /Users/foo/Library/Developer/Xcode/DerivedData/Myproject-cslcvetdcomhqogpwoqocylrlfyq/Build/Products/Debug-iphonesimulator/libPods-LTMorphingLabel.a normal x86_64
    cd /Users/foo/projects/privates/ios/Myproject/Pods
    export IPHONEOS_DEPLOYMENT_TARGET=8.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only x86_64 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.1.sdk -L/Users/foo/Library/Developer/Xcode/DerivedData/Myproject-cslcvetdcomhqogpwoqocylrlfyq/Build/Products/Debug-iphonesimulator -filelist /Users/foo/Library/Developer/Xcode/DerivedData/Myproject-cslcvetdcomhqogpwoqocylrlfyq/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-LTMorphingLabel.build/Objects-normal/x86_64/Pods-LTMorphingLabel.LinkFileList -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/foo/Library/Developer/Xcode/DerivedData/Myproject-cslcvetdcomhqogpwoqocylrlfyq/Build/Intermediates/Pods.build/Debug-iphonesimulator/Pods-LTMorphingLabel.build/Objects-normal/x86_64/Pods_LTMorphingLabel.swiftmodule -framework Foundation -framework QuartzCore -framework UIKit -o /Users/foo/Library/Developer/Xcode/DerivedData/Myproject-cslcvetdcomhqogpwoqocylrlfyq/Build/Products/Debug-iphonesimulator/libPods-LTMorphingLabel.a

I installed by cocoapod.
My environment is as follows.

  • OS X 10.9.5
  • Xcode 6.1.1
  • cocoapod 0.35.0
  • libtool (Apple Inc. version cctools-862)

I am glad and enjoy tips for resolution.
Thank you.

Doesn't work for attributed strings

Trying to set an LTMorphingLabel's attributedText property currently causes an exception.

You probably have a better sense than I do about how hard adding support for attributed strings would be. I'm happy to dive in and help if it seems like it's low-hanging fruit. Thoughts?

Thanks!

Make public properties @IBInspectable

Hi, great component so far! Having access to the following properties at design time would be very helpful and would cut down on boilerplate code to use this control:

public var morphingProgress: Float
public var morphingDuration: Float
public var morphingCharacterDelay: Float
public var morphingEffect: LTMorphingEffect

I believe we could implement this just by marking these properties as @IBInspectable. Do you think there's anything else we'd have to do?

How to disable the text effect when init?

When my view first loaded, I want to set some value for the label without effect animation.
How to make it?

self.upNumTxt.text = "init val"

Any suggestions ? Thx

Attributed Text Support

I believe the current version doesn't support morphing for attributed text. Will this be a feature in the near future?

♥️ Apps using LTMorphingLabel

I would appriciate it if you tell me that your App is using LTMorphingLabel. Your shinny app may encourage me to make this lib better. And I'll list your App in the README.

Thanks.

Use of undeclared type 'LTMorphingLabel'

First of all, let me start by saying I love this project !
I have a project with 5-6 pods working on it, lately I've added this pod as well.
everything find when i'm adding label on storyboard and setting it to LTMorphingLabel.
The problem start when i'm trying to connect the label to code:
@IBOutlet private var label: LTMorphingLabel!
i'm getting this error, Use of undeclared type 'LTMorphingLabel'.
I've tried to import LTMorphingLabel class but it's not recognise as well, of course i've tried to close the project and clean it. did it happen to any of you ? is there any solution for this ? thank you so much. god bless.

Problem on showing 0 (zero) in the label, Swift 2.2 and Xcode7.3

After updating my project to Swift 2.2 in xcode 7.3 none of the following code showing 0 (zero) in the label.

myMorphingLabel.text = "0"

Or

let zeroValue = 0
myMorphingLabel.text = String(zeroValue)
myMorphingLabel.text = String(format: "\(zeroValue)")

But if I try with 1 or 0.0, it works.
Can please check this? Thanks.

Why I can't run your demon in Xcode 6.2 and 6.3 ?

Sorry, I'm a beginner in iOS.
Recently I'm doing a project for practice
but there is a error confuse me why there're a lot of code which I found in GitHub.
Can't run in my Xcode.
:-(
By the way, I'm also a Chinese.
2015-03-17 7 37 21

Crippled performance, sometimes crashing on longer strings

I've found that setting strings longer than about 50 characters crawls to a halt. Sometimes crashes. A simple fix would be to just not animate if the length is greater than a certain number. I attempted to do this by modifying the setter for the text variable, pausing the display link and setting super.text to the value if it was above a threshold. This sometimes works, but I think I'm missing something, as I still get issues with performance. Advice appreciated. Would love to use this in the next rev of Slated if I can get it reliable.

image not found / exc_bad_access

i use "carthage update" to generate the framework file then i drag it into a single-view sample application and try to run it .After built, it crash and here is the output info

dyld: Library not loaded: @rpath/LTMorphingLabel.framework/LTMorphingLabel
Referenced from: /private/var/mobile/Containers/Bundle/Application/BC12B185-E20D-4B3A-9CEB-A9C1EDD18336/cccccc.app/cccccc
Reason: image not found
(lldb)

then i try add it into embedded binaries(before it the framework file was only be added in Linked Frameworks and Libraries )
after that it works. there is no more crash.
when storyboard is empty the sample application looks well.
then i add a label and a button like this:

import UIKit
import LTMorphingLabel

class ViewController: UIViewController {

@IBOutlet weak var label: LTMorphingLabel!

@IBAction func button(sender: AnyObject) {
    label.text = "123"
}
override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

}

build it and run on my phone when i tap the button where is a EXC_BAD_ACCESS error

Is there something important i missed?

Label does not show after view is loaded

When my view is loaded, label is not visible. Only after certain action is taken to change label's text, label finally shows up.

Maybe there is something speciffic with configuration parameters that hides my label, I don't know. When I change my label's class to regular UILabel, it is visible, so there must be something with the LTMorphingLabel class itself.

Text alignment is strange on IOS 8

Hi,

Congrats for this label, it's very cool.
I have a problem. Everything displays properly centered on IOS 7 but is offsetted to the right on iOS 8 .
Do you have an idea?

Thanks

CocoaPods and Carthage

I knew CocoaPods is now compatible with Swift libs. And there is also another awesome option made by GitHub.
I'd like to support both.

Use this Lib in OC Project

Hi man!

Thanks for your job!

请问在OC 项目中如何设置效果?
.morphingEffect 在OC 中无法访问,且在Xcode自动生成的头文件中没有看到这个枚举选项。

多谢帮助。

App crashes when getting or setting the text property

I installed this by just dragging in the LTMorphingLabel folder (I firstly installed with cocoapods but it got messed up so I removed it).

I just followed the instructions under Usage and added a UILabel in storyboard and link it with @IBOutlet and changed its class to LTMorphingLabel

@IBOutlet var lbl:LTMorphingLabel!

I get no error message or anything, it just breaks at the line where I either try to print out its text or when I try to set its text.

Im using xcode 6.2 and swift 1.1

EXC_BAD_ACCESS

A brand new and pure swift project, followed the instruction to add LTMorphingLabel. Build is fine, but when app is running, XCODE gives EXC_BAD_ACCESS. wondering why...

Resources not accessible when using frameworks

The resources folder(needed by Sparkle, Burn and Particle) doesn't seem to be accessible with use_frameworks in CocoaPods. If you drag the resources folder from the LTMorphingLabel pod into your project, it works ok. Not sure if there's a better approach. This should however be mentioned probably in the readme.

How can I change the text of the label without the animation?

Sometimes, I don't want to the animation to occur when I set the text. I thought this would work:

// label's initial text is 00:04
label.morphingEnabled = false
label.text = "hello"
label.morphingEnabled = true

And this is what happened:

simulator screen shot jul 24 2016 5 57 53 pm

The app basically froze in that frame of the animation. Why?

Interface builder font

I've added the files manually to my project (just drag&drop, no framework created) since I have some issues with CocoaPods/Carthage.
I have also set the Interface Builder class object of the label to LTMorphingLabel. Did not add module since it's the current one.

Issue is the label is displayed with some default font instead of the one set in the storyboard. The text also has a big top offset and only the top half is displayed. The label does not have a height constraint in the storyboard, it just has top/bottom/trailing/leading spaces to superview set.

Thank you for the library, I really appreciate it. Job well done!

Edit: The text position is almost fixed if I call layoutSubviews() on the label. The baseline is still a few pixels lower than the text using UILabel.

Multiline support

I know you have this in your notes, but wanted to let you know I think that's the one feature limiting this. That, or at least having auto shrink work. Really slick effects, though. I tried to do this myself, but failed miserably compared to this component. Considering this for the translation area of my keyboard translation app (grab a free copy here: http://tokn.co/ysqhsq9u).

New Bug from installing Xcode 7.3

...
Error in the LTMorphingLabel.swift file on installing Xcode 7.3.

On the line :
(if previousText != text && currentFrame++...) and ( if ++skipFramesCount > closure() {...)
There is the error '++ is deprecated and will be removed in Swift 3. I don't know how yet, but these lines will need an update. .

// MARK: - Animation extension
extension LTMorphingLabel {

    func displayFrameTick() {
        if displayLink.duration > 0.0 && totalFrames == 0 {
            let frameRate = Float(displayLink.duration) / Float(displayLink.frameInterval)
            totalFrames = Int(ceil(morphingDuration / frameRate))

            let totalDelay = Float((text!).characters.count) * morphingCharacterDelay
            totalDelayFrames = Int(ceil(totalDelay / frameRate))
        }

        if previousText != text && currentFrame++ < totalFrames + totalDelayFrames + 5 {
            morphingProgress += 1.0 / Float(totalFrames)

            if let closure = skipFramesClosures[
                "\(morphingEffect.description)\(phaseSkipFrames)"
                ] {
                    if ++skipFramesCount > closure() {
                        skipFramesCount = 0
                        setNeedsDisplay()
                    }
            } else {
                setNeedsDisplay()
            }

            if let onProgress = delegate?.morphingOnProgress {
                onProgress(self, morphingProgress)
            }
        } else {
            displayLink.paused = true

            delegate?.morphingDidComplete?(self)
        }
    }

Image not found

I used CocoaPod to integrate LTMorphingLabel,

When I was using style

label.morphingEffect = .Anvil

I got fatal error: unexpectedly found nil while unwrapping an Optional value

This line caused crash

let image = UIImage(named:"Sparkle")!.CGImage

"Sparkle" image was not found. But I saw the image in Resource folder.

Height Can't Be Changed?

I'm noticing that when I change the height of the label, the vertical text alignment never changes.

The text appears to be vertically centered to the height it was originally created with, and then never adjusts after that when the frame height is changed.

Am I doing something wrong? Is there a way to trigger a relayout? I've already tried setNeedsLayout but that didn't seem to have any affect.

fatal error: unexpectedly found nil while unwrapping an Optional value

My code like below :

    var label89val: LTMorphingLabel!
    label89val = LTMorphingLabel(frame: CGRectMake(20, 10, 80, 80))
    label89val.delegate = self
    label89val.morphingEffect = .Scale
    label89val.text = "0"
    label89val.textColor = UIColor.whiteColor()
    label89val.font = UIFont.boldSystemFontOfSize(23)
    label89val.setNeedsDisplay()
    self.view.addSubview(label89val)

always crash at

   label89val.text = "0"

and get this error

fatal error: unexpectedly found nil while unwrapping an Optional value

Emoji Support

There seem to be issues in animations with emojis... they pop up twice or aren't properly removed.

e.g. "Fire 🔥" morphed to "Zap⚡️" will result in "Zap " with a 🔥 and ⚡️ on top of each other. Is there a workaround for this?

I recognize that the amount of people using this library for emojis is probably minuscule, but still would be cool if there were an easy fix.

Love the library so much! Thanks for all your hard work!

Morphing animation messes up San Francisco Display font

I really like how the colon character (:) is a little bit raised up and not touching the baseline in the San Francisco Display font introduced in WWDC 2015. Here is how it is supposed to look like:

screen shot 2016-07-25 at 3 22 54 pm

However, once I changed the text of the label to something else with the .Fall animation, the colon dropped onto the baseline:

screen shot 2016-07-25 at 3 23 22 pm

I believe that this is caused by the way you draw the text using Core Text. Can you fix it?

LTMorphingLabel undeclared identifier

Hi!
I'm new to cocoapods so maybe is my fault...but...
I have a problem running LTMorphingLabel.
I installed it following your instructions

  • gem install cocoapods --pre
  • Added this line to my Podfile: pod 'LTMorphingLabel', '~> 0.0.3'
  • Installed the pod: pod install

Everything goes fine (CMD + u too)
But when I change class from UILabel to LTMorphingLabel I have an Xcode error saying "Use of undeclared identifier LTMorphingLabel".

I noticed frameworks links in red in the Pods -> Framework -> iOS folder so I relinked them, but nothing changes...

Environment

  • OS X 10.10.2
  • Xcode 6.1.1
  • cocoapod 0.36.0.beta.1

(Git demo works like a charm)

Thank you!

Temporary disable animations

Is is possible to disable animations on/off?
It would be nice cos I don't want animations when I initially set text.

Thanks!

DebugPrintable renamed issue

I install pod in my objective -c code and it's give me error like this for many class on pod file

DebugPrintable has been renamed to CustomStringConvertable

Thank you so much for this project !

Thank you so much for this project and for doing it in swift.
however, I'm unable to use it and I don't understand what's wrong my code.
I've declared the outlet as
@IBOutlet var label: LTMorphingLabel!
then setting the text as
label.morphingEffect = .Scale
label.center = CGPointMake(160, 284)
label.text = "I'am a test label"
self.view.addSubview(label)
but for some reason the text doesn't change, plus I can't seem to run your project on simulator. it's successfully finish to load it, but nothing appear on simulator. thank you very much for any help .

Some limitation of lib

Hi lexrus!
I am happy to see your this awesome lib , but there is some limitation of this lib that it could not display arabic words properly like below:

tech

and it should be like this

tech2

arabic word start from right

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.