B4i Library CADisplayLink - A Timer that ticks on each display refresh

Discussion in 'iOS Libraries' started by narek adonts, Mar 30, 2016.

  1. narek adonts

    narek adonts Well-Known Member Licensed User

    Hi,

    Please find attached a wrapper for iOS native CADisplayLink.

    CADisplayLink is much better Timer for animations as it ticks on each display refresh rate.
    (http://www.bigspaceship.com/ios-animation-intervals/)

    I have added a function to add an Interval for each tick but if you don't need it just set Interval=0 and it will tick on each screen refresh rate.

    see attached an example.

    regards

    Narek
     

    Attached Files:

    Erel, JanPRO, Ohanian and 3 others like this.
  2. tufanv

    tufanv Expert Licensed User

    does making tmr.enabled=false also crashes at your example ? if i set to enable true there is no problem but if i set to false the app keeps on crashing on startup.
     
  3. narek adonts

    narek adonts Well-Known Member Licensed User

    It is set to false by default.

    Set enabled=True to start it. After you can set enabled=false
     
    Last edited: Mar 30, 2016
    tufanv likes this.
  4. b4auser1

    b4auser1 Well-Known Member Licensed User

    Hi, Narek

    I saw some interesting wrappers for B4i from you. Could you take a look to create wrapper for XlsxReaderWriter ? This is an Objective-C library for iPhone / iPad and Mac. It parses and writes MS Excel XLSX files.
    https://github.com/renebigot/XlsxReaderWriter
     
  5. narek adonts

    narek adonts Well-Known Member Licensed User

    I dont have a Mac thus I can not wrap 3rd party libraries. Sorry
     
  6. tufanv

    tufanv Expert Licensed User

    the slide is very smooth now ! Thanks for your great module.
     
  7. tufanv

    tufanv Expert Licensed User

    Dear Narek,

    I am successfuly using this in 2 of my apps. In a new app, I use the same codes but i am keep getting a log says : Subs not found: b4i_cadisplaylink
    and i cant slide anything. Am i forgetting stg . You have an idea ?

    edit: In realease mode , it works fine so i suppose it is a problem with a debug mode
     
    Last edited: Apr 25, 2016
  8. Baris Karadeniz

    Baris Karadeniz Active Member Licensed User

    I used your codes in my app but ı get an error; Unknown type: cadisplaylink Are you missing a library reference?

    What can be the problem?
     
  9. narek adonts

    narek adonts Well-Known Member Licensed User

    Did you added the class?
     
  10. Baris Karadeniz

    Baris Karadeniz Active Member Licensed User

    No I didn't add. What should I do?
     
  11. narek adonts

    narek adonts Well-Known Member Licensed User

    there is a class attached in the first post
     
  12. Baris Karadeniz

    Baris Karadeniz Active Member Licensed User

    Here?
    CADisplayLink\Objects\shell\bin\classes\com\adonts\ca\b4i_cadisplaylink.class
     
  13. narek adonts

    narek adonts Well-Known Member Licensed User

    did you downloaded the Exemple project in the 1st post?
     
  14. Baris Karadeniz

    Baris Karadeniz Active Member Licensed User

    Yes. I downloaded and run. Class is this?

    CADisplayLink\Objects\shell\bin\classes\com\adonts\ca\b4i_cadisplaylink.class
     
  15. tman

    tman Member Licensed User

    I ran your example code ( Interval time set at 1000) and expected to get a 1 second timer. However the result was slightly shorter than 1 sec. I used it to increment a number counter (on a label) I was expecting it to count at once per second rate but it runs a little bit fast. I was wondering Why this value (1000) doesn't give me an accurate 1 second timer. I found that setting the interval value at 1017 (1.7% longer) works very well.
    I also noticed that if the timer enabled = false and is set again to false your app will crash. Setting enabled to true more than once will not cause a crash.
     
    Last edited: Aug 11, 2017
Loading...