First you will need Apple's header. If we don't know their code, we can't do anything. Here is some headers for iOS7. iOS7 Headers. A lot of headers to go through. Each works with a specific task.
Today we will look at SBUIController. The goal we are trying to achieve is battery percent.
With the header open we will look for anything with a (+) In obj-c this means it is a class method.
If one is displayed, which sharedInstance is. We can start our ssscript.
[[SBUIController sharedInstance] ] We have our header followed by sharedInstance. Now we need to look for a method to do with battery percentage that has an (-) next to it. (-) is for an instance method.
Not to much further down we see -(int)batteryCapacityAsPercentage;
If we run [[SBUIController sharedInstance]batteryCapacityAsPercentage] in our cydget or while in cycript it will display our current battery percentage.
Example for cydget would be.
<script type="text/cycript"> var batterypercent=[[SBUIController sharedInstance]batteryCapacityAsPercentage]; alert(batterypercent); </script>
No comments:
Post a Comment