GithubHelp home page GithubHelp logo

mukeshthawani / faqview Goto Github PK

View Code? Open in Web Editor NEW
473.0 473.0 29.0 1.79 MB

An easy to use FAQ view for iOS written in Swift

License: MIT License

Swift 96.33% Ruby 2.11% Objective-C 1.56%
cocoapods ios swift swift-3 swift4 ui-components

faqview's People

Contributors

davidlari avatar irshadpc avatar mukeshthawani avatar shi-rudo avatar tomwfox avatar widcket avatar x901 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

faqview's Issues

issue with constraints

Hi ,
I just tried the Demo project
and I get issues with constraints when I clicked on cell (after it expand)

Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x60000272dea0 V:|-(10)-[UILabel:0x7fa285e0a030'What is reddit?'] (active, names: '|':UITableViewCellContentView:0x7fa285e04f20 )>",
"<NSLayoutConstraint:0x60000272ddb0 V:[UILabel:0x7fa285e0a030'What is reddit?']-(10)-[UITextView:0x7fa287007600'reddit is a source for wh...'] (active)>",
"<NSLayoutConstraint:0x60000272dd60 V:[UITextView:0x7fa287007600'reddit is a source for wh...']-(20)-| (active, names: '|':UITableViewCellContentView:0x7fa285e04f20 )>",
"<NSLayoutConstraint:0x60000272db30 UIView:0x7fa285e04ba0.height == UILabel:0x7fa285e0a030'What is reddit?'.height (active)>",
"<NSLayoutConstraint:0x60000277c690 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fa285e04f20.height == 38 (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x60000272ddb0 V:[UILabel:0x7fa285e0a030'What is reddit?']-(10)-[UITextView:0x7fa287007600'reddit is a source for wh...'] (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.
โ‰ˆ2020-02-11 14:16:27.754909+0300 Demo-iOS[11611:178060] [LayoutConstraints] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want.
Try this:
(1) look at each constraint and try to figure out which you don't expect;
(2) find the code that added the unwanted constraint or constraints and fix it.
(
"<NSLayoutConstraint:0x600002767b10 V:|-(10)-[UILabel:0x7fa288070790'How is a submission's sco...'] (active, names: '|':UITableViewCellContentView:0x7fa285c29cb0 )>",
"<NSLayoutConstraint:0x600002767c00 V:[UILabel:0x7fa288070790'How is a submission's sco...']-(10)-[UITextView:0x7fa28083a400'A submission's score is s...'] (active)>",
"<NSLayoutConstraint:0x600002767c50 V:[UITextView:0x7fa28083a400'A submission's score is s...']-(20)-| (active, names: '|':UITableViewCellContentView:0x7fa285c29cb0 )>",
"<NSLayoutConstraint:0x600002767e80 UIView:0x7fa285c29710.height == UILabel:0x7fa288070790'How is a submission's sco...'.height (active)>",
"<NSLayoutConstraint:0x60000272eee0 'UIView-Encapsulated-Layout-Height' UITableViewCellContentView:0x7fa285c29cb0.height == 38 (active)>"
)

Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x600002767c00 V:[UILabel:0x7fa288070790'How is a submission's sco...']-(10)-[UITextView:0x7fa28083a400'A submission's score is s...'] (active)>

Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful.

Feature Request: Image Tappable

Currently, the down arrow image cannot be tapped to open/close the answer. I think many users will instinctively tap on the arrows. To make them respond to taps, the following code can be added to the tableView:cellForRowAt function.

Before the return cell add these four lines:

    cell.indicatorImageView.tag = indexPath.section
    let gestureRecogForImage = UITapGestureRecognizer(target: self, action: #selector(FAQView.handleQuestionLabelTap(_:)))
    cell.indicatorImageView.addGestureRecognizer(gestureRecogForImage)
    cell.indicatorImageView.isUserInteractionEnabled = true

Bug with scrolling off screen

If an expanded cell scrolls off the screen, when it scrolls back on, it is no longer expanded. However, the section number is still in the expandedCells array. Because of this, when you tap on the cell to expand the cell, it won't expand. You must tap it a second time to get it to expand.

I have tried to think of a way to fix this, but there are a couple of different ways to make FAQView behave. One would be to change it so as cells scroll back onto the screen, if they were previously, expanded, show them as expanded.

Or, if leaving them unexpanded is desirable, then somehow the section number must be removed from the expandedCells array when a cell scrolls off.

Scrolling Issue

If there are a bunch of expanded FAQ Items and they go off the screen and I try to scroll down to the last one I can never scroll all the way to the bottom.

This is an odd issue with the scrollview I think.

Please let me know if there is an easy solution.

Thanks

Not installing correctly with cocoapods

When adding pod to the podfile and running pod install it doesn't seem to add the pod to the pod target properly. It generates a folder in Pods directory but not connecting it up. I ended up including FaqView.swift directly for now. I have a bunch of other cocoapods in the project, and all other installations work fine.. am I missing something? Also, the example project doesn't compile for the same reason i think, can't find the module. I'm on Xcode 9.3. Thanks!

Change indicatorImageView color

FAQView 0.6.0 (installed via CocoaPods)
...

Is there a way to change the color of the indicatorImageView (tint), without altering the FAQView.swift?

Bug with title label

Currently, when changing configuration properties of the title label, it stores them in the configuration, but fails to apply the values to the label itself. The setters should modify the appropriate properties of the title label as shown below.

  public var titleLabelColor: UIColor! {
    get {
      return configuration.titleTextColor
    }
    set(value) {
      configuration.titleTextColor = value
      titleLabel.textColor = value    // Added this line
    }
  }
  
  public var titleLabelFont: UIFont! {
    get {
      return configuration.titleTextFont
    }
    set(value) {
      configuration.titleTextFont = value
      titleLabel.font = value    // Added this line
    }
  }
  
  public var viewBackgroundColor: UIColor! {
    get {
      return configuration.viewBackgroundColor
    }
    set(value) {
      configuration.viewBackgroundColor = value
      titleLabel.backgroundColor = value    // Added this line
    }
  }

TextView instead of Label

If anyone is interested, I have created a fork with the following enhancements:

  • Replaced the answer UILabel with a UITextView.
  • Added automatic data detection capability. Just set dataDetectorTypes property array to the types you want to detect and the detector will make them links in the answer.
  • Added answerTintColor to color foreground text color of detected links.
  • Added a new property to Items. You may initialize an item with either the answer String, or attributedAnswer as NSAttributedString. This allows the ability to add links. For example, you could give a brief answer to a question and provide a link for more information.

I needed these features for my app. If there is interest in merging these changes into this project, let me know. Otherwise, just close this issue and I'll maintain my own fork.

Swift 4 Support

Hello Team,

Thank your for this great library.

Just wondering if you are planning on migrating to swift 4 ?

Up/ down arrows don't appear

I install via Cocoapods, copy / paste the code in the readme, run project and the arrows don't appear.

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
    
    faqView()
}


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


func faqView() {
    let items = [FAQItem(question: "What is reddit?", answer: "reddit is a source for what's new and popular on the web."),
                 FAQItem(question: "How is a submission's score determined?", answer: "A submission's score is simply the number of upvotes minus the number of downvotes.")]
    
    let faqListView = FAQView(frame: view.frame, items: items)
    view.addSubview(faqListView)
}

simulator screen shot jan 10 2017 9 13 29 am

Podspec doesn't include Assets

When installing via cocoapods, the Up/down arrow doesn't show up. Upon investigation, it appears that the Assets are not in the project. In looking at your podspec I see that you didn't include them.

This stack overflow answer shows how to do it.
http://stackoverflow.com/a/38286446/2584110

Maybe this needs to be in the podspec:

s.resources = "FAQView/Assets/*.xcassets"

Request for SwiftUI FAQ Demo

I am new in SwiftUI, I want to creat FAQ view means( question answer view). In this view populate number of question and answer. When I click on anyone question, only the answer of that question is visible and not the other question. And the answer of all the questions should be hidden/Collapse.

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.