any open source library for PDF reader - iphone

QUESTION UPDATE
Their is any alternative of fastPDF reader for iphone app. Or any open source library which we can use full in pdf reader feature.
Thanks.

There are three options: buy a FastPdfKit license choosing from Basic, Plus and Extra versions

instead of that you can show any loding... image and present it for 5 seconds. so no one will see the fastpdf logo.

You can sublass MFDocumentViewController and hide the splash screen by hiding the child Image View:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.view.subviews enumerateObjectsUsingBlock:^(UIView *view, NSUInteger idx, BOOL *stop) {
if ([view isKindOfClass:[UIImageView class]]) {
// hide the splash screen
view.hidden = YES;
}
}];
}
But before publishing your app, carefully check first the license. I think the free license is an attribution license, so just leaving out the splash screen won't do it

Related

alert view present on iPhone

I want to check whether the UIALertView is present on the screen or not, though I have done it by using the following method:
-(BOOL) isAlertShowing
{
for (UIWindow* window in [UIApplication sharedApplication].windows) {
NSArray* subviews = window.subviews;
if ([subviews count] > 0)
if ([[subviews objectAtIndex:0] isKindOfClass:[UIAlertView class]])
return YES;
}
return NO;
}
but I came to know that it is undocumented one. So, please tell me authenticate way of doing it.
In an app I submitted (and is approved), I have used a similar approach (see iPhone: detecting if a UIAlert/UIActionSheet are open)...
I don't see why you think it's not a valid method - I'd try it.

iOS: How to access the `UIKeyboard`?

I want to get a pointer reference to UIKeyboard *keyboard to the keyboard on screen so that I can add a transparent subview to it, covering it completely, to achieve the effect of disabling the UIKeyboard without hiding it.
In doing this, can I assume that there's only one UIKeyboard on the screen at a time? I.e., is it a singleton? Where's the method [UIKeyboard sharedInstance]. Brownie points if you implement that method via a category. Or, even more brownie points if you convince me why it's a bad idea to assume only one keyboard and give me a better solution.
Try this:
// my func
- (void) findKeyboard {
// Locate non-UIWindow.
UIWindow *keyboardWindow = nil;
for (UIWindow *testWindow in [[UIApplication sharedApplication] windows]) {
if (![[testWindow class] isEqual:[UIWindow class]]) {
keyboardWindow = testWindow;
break;
}
}
// Locate UIKeyboard.
UIView *foundKeyboard = nil;
for (UIView *possibleKeyboard in [keyboardWindow subviews]) {
// iOS 4 sticks the UIKeyboard inside a UIPeripheralHostView.
if ([[possibleKeyboard description] hasPrefix:#"<UIPeripheralHostView"]) {
possibleKeyboard = [[possibleKeyboard subviews] objectAtIndex:0];
}
if ([[possibleKeyboard description] hasPrefix:#"<UIKeyboard"]) {
foundKeyboard = possibleKeyboard;
break;
}
}
}
How about using -[UIApplication beginIgnoringInteractionEvents]?
Also, another trick to get the view containing the keyboard is to initialize a dummy view with CGRectZero and set it as the inputAccessoryView of your UITextField or UITextView. Then, get its superview. Still, such shenanigans is private/undocumented, but I've heard of apps doing that and getting accepted anyhow. I mean, how else would Instagram be able to make their comment keyboard interactive (dismiss on swipe) like the Messages keyboard?
I found that developerdoug's answer wasn't working on iOS 7, but by modifying things slightly I managed to get access to what I needed. Here's the code I used:
-(UIView*)findKeyboard
{
UIView *keyboard = nil;
for (UIWindow* window in [UIApplication sharedApplication].windows)
{
for (UIView *possibleKeyboard in window.subviews)
{
if ([[possibleKeyboard description] hasPrefix:#"<UIPeripheralHostView"])
{
keyboard = possibleKeyboard;
break;
}
}
}
return keyboard;
}
From what I could make out, in iOS 7 the keyboard is composed of a UIPeripheralHostView containing two subviews: a UIKBInputBackdropView (which provides the blur effect on whatever's underneath the keyboard) and a UIKeyboardAutomatic (which provides the character keys). Manipulating the UIPeripheralHostView seems to be equivalent to manipulating the entire keyboard.
Discaimer: I have no idea whether Apple will accept an app that uses this technique, nor whether it will still work in future SDKs.
Be aware, Apple has made it clear that applications which modify private view hierarchies without explicit approval beforehand will be rejected. Take a look in the Apple Developer Forums for various developers' experience on the issue.
If you're just trying to disable the keyboard (prevent it from receiving touches), you might try adding a transparent UIView that is the full size of the screen for the current orientation. If you add it as a subview of the main window, it might work. Apple hasn't made any public method of disabling the keyboard that I'm aware of - you might want to use one of your support incidents with Apple, maybe they will let you in on the solution.
For an app I am currently developing I am using a really quick and easy method:
Add this in the header file:
// Add in interface
UIWindow * _window;
// Add as property
#property (strong, nonatomic) IBOutlet UIView * _keyboard;
Then add this code in the bottom of the keyboardWillShow function:
-(void) keyboardWillShow: (NSNotification *) notification {
.... // other keyboard will show code //
_window = [UIApplication sharedApplication].windows.lastObject;
[NSTimer scheduledTimerWithTimeInterval:0.05
target:self
selector:#selector(allocateKeyboard)
userInfo:nil
repeats:NO];
}
This code look for when the keyboard is raised and then allocates the current window. I have then added a timer to allocate the keyboard as there were some issues when allocated immediately.
- (void)allocateKeyboard {
if (!_keyboard) {
if (_window.subviews.count) {
// The keyboard is always the 0th subview
_keyboard = _window.subviews[0];
}
}
}
We now have the keyboard allocated which gives you direct "access" to the keyboard as the question asks.
Hope this helps
Under iOS 8 it appears you have to jump down the chain more than in the past. The following works for me to get the keyboard, although with custom keyboards available and such I wouldn't rely on this working unless you're running in a controlled environment.
- (UIView *)findKeyboard {
for (UIWindow* window in [UIApplication sharedApplication].windows) {
UIView *inputSetContainer = [self viewWithPrefix:#"<UIInputSetContainerView" inView:window];
if (inputSetContainer) {
UIView *inputSetHost = [self viewWithPrefix:#"<UIInputSetHostView" inView:inputSetContainer];
if (inputSetHost) {
UIView *kbinputbackdrop = [self viewWithPrefix:#"<_UIKBCompatInput" inView:inputSetHost];
if (kbinputbackdrop) {
UIView *theKeyboard = [self viewWithPrefix:#"<UIKeyboard" inView:kbinputbackdrop];
return theKeyboard;
}
}
}
}
return nil;
}
- (UIView *)viewWithPrefix:(NSString *)prefix inView:(UIView *)view {
for (UIView *subview in view.subviews) {
if ([[subview description] hasPrefix:prefix]) {
return subview;
}
}
return nil;
}

Play youtube video on iPhone by not pressing the default video icon

i want to know if it is possible to launch the youtube video without launching the default small photo icon. I just need a regular icon which is able to be launched to play a youtube video. Unfortunately, as the Youtube official suggestion suggests, there is currently no way to fulfill my request. Does any body concern this issue and already figure this out?
http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
if I understood your question correctly:
embed youtube player in a UIWebview and set the webview to hidden
in your customized button method do the following:
a- search for UIButton in the webview subviews :
-(UIButton*)getButtonInView:(UIView*)view{
UIButton *button = nil;
if([view isMemberOfClass:[UIButton class]]){
return (UIButton*) view;
}
if(view.subviews && [view.subviews count] > 0) {
for(UIView *subview in view.subviews) {
button=[self getButtonInView:subview];
if(button) return button;
}
}
return button;
}
b- send action to the fetched button:
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
hope that will help
----NOTE----
As mentioned by lxt. Please note that that this solution relies on Youtube plugin implementation not changing otherwise it might break in the future.

iPhone: Get a list of clickable areas on screen in cocoa touch

I have an iPhone app and I want to get a list of co-ords that are clickable by a user. I want to automate testing and have a client app click around on screen but just choosing random coords isn't ideal so a list of coords that are definitely clickable would be much better.
So far I have this the view passed in is top level window:
getSubViewsCoords:(UIView *)view {
iAppDelegate* appDelegate = [[UIApplication sharedApplication] delegate];
for (UIView *tempView in [view subviews]) {
// check if view responds to touch i.e. is an interactive view.
// go up through responder chain
// check if it reacts
// if it does then add to the gorilla's list
UIView *responderObj = tempView;
while (responderObj = [responderObj nextResponder]) {
if([responderObj respondsToSelector:#selector(touchesBegan:withEvent:)]){
// get xy etc and add to instance var
//then recall this function
// convert to top level windows co-ordinate system.
CGRect viewRect = [tempView convertRect:[tempView bounds] toView:nil];
clickableAreas = [clickableAreas stringByAppendingString: NSStringFromCGRect(viewRect)];
clickableAreas = [clickableAreas stringByAppendingString: #"\n"];
break;
}
}
[self getSubViewsCoords:tempView];
Is this the correct way to go about it? Is there an easier way to get this information?
Thanks in advance for your help.
If you haven't already read it, you'll probably find this article helpful, Automated user interface testing on the iPhone.

Simple iPhone image viewer howto

I need to develop simple image viewer, much like the default iPhone Photos application, but for images located on remote server. I don't have any point where to start as I don't have any experience yet with such task (how to make a slideshow and how to handle animations when user slides photos with his finger etc.)
Can you please point me to some source - docs, howtos or sample project of such a kind?
I recommend you start with Joe Hewitt's three20 library (introductory text here). In the TTCatalog sample app, you will find a photo browser and three20 has been designed to easily use photos from remote servers.
Try this one https://github.com/mwaterfall/MWPhotoBrowser
Visit http://www.raywenderlich.com/1845/how-to-create-a-simple-iphone-app-tutorial-part-2
Might I recommend Titanium from Appcelerator? I have worked in both xcode and titanium and for quick and dirty projects, titanium might work. Lots of demos out there.
Here's my implementation:
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
self.startX = scrollView.contentOffset.x;
}
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
//NSLog(#"scrollViewDidEndDragging");
self.endX = scrollView.contentOffset.x;
self.photoIdx = (int)self.startX / Normalize(1160);
if (decelerate == FALSE)
{
int intoThePhoto = (int)self.photoScrollView.contentOffset.x % Normalize(1160);
if (intoThePhoto < Normalize(1060/2))
[scrollView setContentOffset:CGPointMake(Normalize(1160)*self.photoIdx,0) animated:YES];
else
[scrollView setContentOffset:CGPointMake(Normalize(1160)*(self.photoIdx+1),0) animated:YES];
}
}
-(void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
if ((self.endX - self.startX) > 0 && self.photoIdx < ([self.photos count] -1))
[scrollView setContentOffset:CGPointMake(Normalize(1160)*(self.photoIdx+1),0) animated:YES];
else if ((self.endX - self.startX) < 0 && self.photoIdx != 0)
[scrollView setContentOffset:CGPointMake(Normalize(1160)*(self.photoIdx-1),0) animated:YES];
}