Coder Social home page Coder Social logo

mozhouqi / kmplaceholdertextview Goto Github PK

View Code? Open in Web Editor NEW
803.0 13.0 140.0 200 KB

A UITextView subclass that adds support for multiline placeholder written in Swift.

License: MIT License

Swift 87.56% Ruby 8.12% Objective-C 4.32%
placeholder placeholdertextview uitextview swift

kmplaceholdertextview's People

Contributors

afnanm1999 avatar brentleyjones avatar kelvinlaukl avatar maurovc avatar mozhouqi avatar rogymd avatar thekie avatar tladesignz avatar vydev 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

kmplaceholdertextview's Issues

Swift 2.2 warnings

Thank you for the awesome Pod!

We just migrated to swift 2.2 and we liked how KMPlaceholderTextView had no warnings before. Now we are getting a few, see below. Would it be possible to have a release without warnings? Thank you!

▸ Compiling KMPlaceholderTextView.swift

⚠️ /Pods/KMPlaceholderTextView/KMPlaceholderTextView/KMPlaceholderTextView.swift:90:23: use of string literal for Objective-C selectors is deprecated; use '#selector' instead

        selector: "textDidChange",
                  ^~~~~~~~~~~~~~~

▸ Compiling KMPlaceholderTextView.swift

⚠️ /Pods/KMPlaceholderTextView/KMPlaceholderTextView/KMPlaceholderTextView.swift:90:23: use of string literal for Objective-C selectors is deprecated; use '#selector' instead

        selector: "textDidChange",
                  ^~~~~~~~~~~~~~~

Swift 3 conversion

Hi,

现在每次 pod update 了之后,Xcode 会提示说 KMPlaceholderTextView 没有用 Swift 3 的语法,需要convert。不知道是不是只是我的Xcode 这样?

BR
An Chin

Keyboard show up

I have an issue when trying to start typing into the textview, if i tap on the textview the keyboard does not show up, only until i tap in the same line that the placeholder is, does not detect the rest of the text view as editable, if i add many text and later try to edit by tapping on that text happens the same, looks like it only accepts touch on an imaginary line on the top of the textview.. Using Swift 3, and the last version of the pod, 1.3.0.

Rendering Performance

Hi
The KMPlaceholderTextView won't give access to the UILabel used, so it's really difficult to setup the backgroundColor. Why do we care about it if it's transparent?. One of the slowest operations is rendering. In my case I'm using a lot of instances of KMPlaceholderTextView so if you use “Color Blended Layers" in the iPhone Simulator, you will see a lot of red areas.

It would be really useful to have access to the background color of the UILabel - through a method- or the UILabel. Right now it's marked as private.

Can't see placeholder after set in Storyboard

Hi,

I have add UITextView and set to KMPlaceholderTextView and set the placeholder property but whenever I run the app placeholder value can't see and getting the below warning.

Can you please help me asap?

Unknown class KMPlaceholderTextView in Interface Builder file.
Failed to set (placeholder) user defined inspected property on (UITextView): [<UITextView 0x799c5000> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key placeholder.
] Failed to set (placeholder) user defined inspected property on (UITextView): [<UITextView 0x79a17800> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key placeholder.

Resizing based off placeholderLabel

Would it be possible to add auto layout constraints to adjust the size of the text view based off the size of the placeholder label height. Right now, the placeholder label will go off the view otherwise.

Has ambiguous scrollable content height

Thank you for useful pod!

We have an issue using it in a storyboard. When adding a height constraint to the it Storyboard shows the warning: Has ambiguous scrollable content height.

Is there a workaround for that? Or way to fix it?

After investigation and StackOverflow research we think it's because IBDesignable KMPlaceholderTextView has placeholder subview, which UITextView UIScrollView probably takes as content and cause ambiguity.

Add attributed placeholder

It would be cool to have the option to add an attributed placeholder like this:

open var attributedPlaceholder: NSAttributedString? {
     didSet {
         placeholderLabel.attributedText = attributedPlaceholder
     }
}

Thanks!

Install manually

how to install KMPlaceholderTextView manually without cocoapods?

paste not working

Hai,
In Empty Textview if I try to paste its not working..when I type some letters after that only it can allow to paste.

Swift Comiler Error

KMPlaceholderTextView
1./UIKit.NSNotification.Name:5:23:

'UITextViewTextDidChange' was obsoleted in Swift 4.2

UITextViewTextDidChange' has been renamed to 'UITextView.textDidChangeNotification'

Replace 'UITextViewTextDidChange' with 'UITextView.textDidChangeNotification'

2/UIKit.NSNotification.Name:5:23:

'UITextViewTextDidChange' was obsoleted in Swift 4.2'

'UITextViewTextDidChange' has been renamed to 'UITextView.textDidChangeNotification'

Replace 'UITextViewTextDidChange' with 'UITextView.textDidChangeNotification'

Not scrolling for textview

There is a problem when you try to set a text programmatically that will be long just a little bit that the textview. In this case, the textview (not editable) will not scroll.

I solved using a old solution removing constraints and using a frame to the placeholder label.
This is not the right solution, but it works.

IB Designables Failure

Hello!

I'm getting this issue with the latest version...

file:///Users/sulkuatam/src/app/app-ios/Base.lproj/Main.storyboard: error: IB Designables: Failed to update auto layout status: The bundle “$(PRODUCT_NAME)” couldn’t be loaded because its executable couldn’t be located.

Not sure what the issue is... thanks in advance for any help!

screen shot 2016-05-31 at 11 36 52 am

No such module KMPlaceholderTextView

We use your library as pod, but pulling from master branch, since pod spec was last updated 2 years ago.
Recently we started getting this error.
It seems that it is a result of moving source files to Sources folder. Podspec file was not change to accommodate this change.

IB Designables error

error: IB Designables: Failed to render instance of KMPlaceholderTextView: Rendering the view took longer than 200 ms. Your drawing code may suffer from slow performance.

how can i figure that error?

NSLocalizedString not working

It seems that setting localization for KMPlaceholderTextView doesn't work. I tried doing it in viewDidLoad() and assigning NSLocalizedString to KMPlaceholderTextView.placeholder and it didn't

Support Carthage

It would be nice if this package could be installed via Carthage. You just need to make the build scheme public to make this work. 👍

YOUTUBE VIDEO TUTORIAL

Hi,
I like KMPlaceholderTextView so much that (besides using it in my own projects) I have created a video tutorial on how to use it:

https://youtu.be/b-ODoxT7qMo

If you like it feel free to add it to the README of your repo. You can also add this image so visitors may click on it easily:
placeholder in uitextview in swift 2019 thubmnail

Compiling has a error.

I use the text view in storyboard named "Mine".And I have the other storyboard.
It is normal if I didn't click the Mine storyboard.
It will show a Error when I clicked Mine storyboard. It is bad.
Error info:
Failed to render and update auto layout status for SuggestionViewController (EBX-d9-iDK): dlopen(KMPlaceholderTextView.framework, 1): no suitable image found. Did find:
KMPlaceholderTextView.framework: required code signature missing for 'KMPlaceholderTextView.framework'

Swift 3 compatibility

Is there a branch for swift3 or any further update to make this work on Xcode 8? I'm getting this issue trying to run it:

screen shot 2016-09-07 at 1 46 45 pm

It doesn't works with iOS10

In iOS10 it doesn't show anything, i can set the placeholder text and color in IB but there is no placeholder when i launch the app

iOS 7 auto layout exception.

Hello, getting the exception on iOS 7.1.2 on iPhone 4, on iOS 8 and 9 everything works good.

Here is text of exception:

Fatal Exception: NSInternalInconsistencyException
Auto Layout still required after executing - layoutSubviews.
KMPlaceholderTextView's implementation of -layoutSubviews needs to call super.

little problem with the solution

KMPlaceholderTextView.swift:33:31: Cannot override mutable property 'placeholder' of type 'String?' with covariant type 'String'

Failed to render and update auto layout

file:///..../UI/Training.storyboard: error: IB Designables: Failed to render and update auto layout status for RescheduleTrainningViewController (JFO-mQ-3bH): dlopen(KMPlaceholderTextView.framework, 1): Symbol not found: __TMps13OptionSetType
Referenced from: KMPlaceholderTextView.framework
Expected in: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Xcode/Overlays/../../../../../../Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator/libswiftCore.dylib
in KMPlaceholderTextView.framework

After I upgrade to XCode 8.1 (8B62) using Swift 2.3 and version 1.2.2 of KMPlaceholderTextView
appears a lot of errors like I paste above.
I use "pod 'KMPlaceholderTextView', '~> 1.2.2' ' on podfile.

All views on storyboard that uses KMPlaceholderTextView stay white on XCode.

Required code signature missing error

Received the following error "kmplaceholdertextview required code signature missing" after installing Podfile.

Resolved by adding the following command to the Podfile:

post_install do |installer|
    installer.pods_project.build_configurations.each do |config|
        config.build_settings.delete('CODE_SIGNING_ALLOWED')
        config.build_settings.delete('CODE_SIGNING_REQUIRED')
    end
end

Text reverts to "Placeholder" after deleting text in view

The textview display the correct placeholder text (in my case, "Type here") when it is loaded. When I tap into the textview and enter text, then delete the text, the correct placeholder comes back. However, after the keyboard is dismissed, the placeholder text reverts to "Placeholder", which I assume is the default for the KMPlaceholderTextView.

Swift 2 support

It would be nice if this library would also support swift 2. Maybe in a separate branch?

Add Documentation about Swift 2.x / Swift 3 compatibility

Hey there,

I've just updated to the latest available CocoaPod and hit some compilation issues due to not yet having upgraded to Swift 3.

Suggest popping some notes in your README or release notes mentioning it.

Keep up the great work !

Is it is 7.0+ or iOS 8.0+?

During pod installation I get this message:

The platform of the targetPods(iOS 7.0) is not compatible withKMPlaceholderTextView (0.1.1)which has a minimum requirement of iOS 8.0.

Yet, in the requirements for the control you say it's 7.0+

What am I doing wrong?

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.