Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ANNotunzdY
committed
May 13, 2011
1 parent
cae27f1
commit 7353555
Showing
8 changed files
with
1,303 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// BKAlertView.h | ||
// BonjourKit | ||
// | ||
// Created by あんのたん on 2009/07/27. | ||
// Copyright 2009 株式会社パンカク. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "BKBrowserViewController.h" | ||
|
||
@interface BKAlertView : UIAlertView { | ||
BKBrowserViewController* browser; | ||
} | ||
@property (nonatomic, assign) id<BKBrowserViewControllerDelegate> delegate; | ||
|
||
- (id)initWithTitle:(NSString *)aTitle; | ||
- (BOOL)searchForServicesOfType:(NSString *)type inDomain:(NSString *)domain; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// | ||
// BKAlertView.m | ||
// BonjourKit | ||
// | ||
// Created by あんのたん on 2009/07/27. | ||
// Copyright 2009 株式会社パンカク. All rights reserved. | ||
// | ||
|
||
#import "BKAlertView.h" | ||
|
||
|
||
@implementation BKAlertView | ||
|
||
@dynamic delegate; | ||
|
||
- (id)initWithTitle:(NSString *)aTitle { | ||
|
||
if (aTitle == nil) { | ||
aTitle = [[UIDevice currentDevice] name]; | ||
} | ||
|
||
self = [super initWithTitle:aTitle message:@"\n\n\n\n\n\n" delegate:nil cancelButtonTitle:@"Cancel" otherButtonTitles:nil]; | ||
|
||
if (self) { | ||
browser = [[BKBrowserViewController alloc] initWithTitle:nil showDisclosureIndicators:NO showCancelButton:NO frame:CGRectMake(11, 50, 261, 120)]; | ||
browser.ownName = aTitle; | ||
|
||
//UILabel *bodyTextLabel; | ||
//object_getInstanceVariable(self, "_bodyTextLabel", (void **)&bodyTextLabel); | ||
//[browser.view setFrame:[bodyTextLabel bounds]]; | ||
//[bodyTextLabel addSubview:[browser view]]; | ||
|
||
[self addSubview:browser.tableView]; | ||
|
||
} | ||
|
||
return self; | ||
} | ||
|
||
- (BOOL)searchForServicesOfType:(NSString *)type inDomain:(NSString *)domain { | ||
return [browser searchForServicesOfType:type inDomain:domain]; | ||
} | ||
|
||
- (id<BKBrowserViewControllerDelegate>)delegate { | ||
return [browser delegate]; | ||
} | ||
|
||
- (void)setDelegate:(id<BKBrowserViewControllerDelegate>)aDelegate { | ||
[super setDelegate:aDelegate]; | ||
[browser setDelegate:aDelegate]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
<codex> | ||
<abstract>View controller for the service instance list. | ||
This object manages a NSNetServiceBrowser configured to look for Bonjour services. | ||
It has an array of NSNetService objects that are displayed in a table view. | ||
When the service browser reports that it has discovered a service, the corresponding NSNetService is added to the array. | ||
When a service goes away, the corresponding NSNetService is removed from the array. | ||
Selecting an item in the table view asynchronously resolves the corresponding net service. | ||
When that resolution completes, the delegate is called with the corresponding NSNetService.</abstract> | ||
</codex> | ||
*/ | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <Foundation/NSNetServices.h> | ||
|
||
@class BKBrowserViewController; | ||
|
||
@protocol BKBrowserViewControllerDelegate <NSObject> | ||
@required | ||
// This method will be invoked when the user selects one of the service instances from the list. | ||
// The ref parameter will be the selected (already resolved) instance or nil if the user taps the 'Cancel' button (if shown). | ||
- (void) browserViewController:(BKBrowserViewController *)bvc didResolveInstance:(NSNetService *)ref; | ||
@end | ||
|
||
@interface BKBrowserViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> { | ||
|
||
@private | ||
id<BKBrowserViewControllerDelegate> _delegate; | ||
NSString *_searchingForServicesString; | ||
NSString *_ownName; | ||
NSNetService *_ownEntry; | ||
BOOL _showDisclosureIndicators; | ||
NSMutableArray *_services; | ||
NSNetServiceBrowser *_netServiceBrowser; | ||
NSNetService *_currentResolve; | ||
NSTimer *_timer; | ||
BOOL _needsActivityIndicator; | ||
BOOL _initialWaitOver; | ||
UITableView* tableView; | ||
} | ||
|
||
@property (nonatomic, assign) id<BKBrowserViewControllerDelegate> delegate; | ||
@property (nonatomic, copy) NSString *searchingForServicesString; | ||
@property (nonatomic, copy) NSString *ownName; | ||
@property (nonatomic, readonly) UITableView* tableView; | ||
|
||
- (id)initWithTitle:(NSString *)title showDisclosureIndicators:(BOOL)show showCancelButton:(BOOL)showCancelButton frame:(CGRect)frame; | ||
- (BOOL)searchForServicesOfType:(NSString *)type inDomain:(NSString *)domain; | ||
- (void)stop; | ||
@end |
Oops, something went wrong.