Is there no way to make the status bar translucent for the iPad. I get this error when trying to do this: UIStatusBarStyleBlackTranslucent is not available on this device.
I want to offer a "highscore" list for friends in my app (at this point iPhone/iPad), so that if the user connected to facebook, he will get a list with his/her friends scores.
Connecting is easy, retrieving friends is easy, but figuring out the best way to store the scores is not.
As it seems I need to the store the scores on my own server server, no big deal. But what is considered a reasonable safe way to transfer the data? When communicating with facebook, authentication is clear - but communicating with my server basically anyone could post scores for another user if I send user id and score. Obfuscation might help a bit, but is there any better way to make sure that the data comes from the fb-logged-in person?
Scores can also go down, so changing scores for other persons won't necessary help them.
Thanks :)
I have a few separate applications which are all launched purely through a main application.
I am wondering if I'd be able to use intents to retrieve a list of all the sub-applications which match some discovery intent.
The main application currently needs to know what Intents to use to START these sub-applications, but is there a way to use intents to see if other Activities on the device match a set of intent-filters?
I am working on an iPhone app and am getting (null) references to IBOutlet fields in my controller. I have a UIViewController subclass that is set as the File's Owner in my XIB. I have a set of UI elements that are wired into the controller. After loading from NIB and attempting to set properties on those UI elements, I find that they are (null). To clarify, some code:
ExpandSearchPageController.h:
@interface ExpandSearchPageController : UIViewController
{
IBOutlet UITextView * completeMessageView;
}
-(void)checkTextField;
@property (nonatomic, retain) IBOutlet UITextView * completeMessageView;
ExpandSearchPageController.m:
@implementation ExpandSearchPageController
@synthesize completeMessageView;
-(void)checkTextField
{
NSLog(@"text field: %@",completeMessageView);
}
ExpandSearchPageController is set as the File's Owner for ExpandSearchPage.xib. ExpandSearchPage.xib's UITextView is wired to the completeMessageView.
When I call
ExpandSearchPageController * searchExpanderPage = [[ExpandSearchPageController alloc] initWithNibName:@"ExpandSearchPage" bundle:[NSBundle mainBundle]];
[searchExpanderPage checkTextField];
the result is
"text field: (null)"
Sorry if this is a total newb question, but I guess I'm still a newb at iPhone programming!
Thanks in advance!
For an app I am working on I want a custom keyboard to come up when you tap on an input field in a UIWebview, for example for UITextView i use this code :
myText.text = [myText.text stringByAppendingString:@"a"];
but i don't know how can i fill a text field in UIWebVIew
Any help would be very much appreciated; thanks!
Hi,
I have this sql statement SELECT * FROM Language WHERE LanguageCode=? where LanguageCode is a varchar(2).
When I use sqlite3-prepare-v2 on that statement I got SQLITE_ERROR but if I use SELECT * FROM Language WHERE LanguageID=? where LanguageID is the primary key numeric identity field the statement compiles just fine.
Is there any issue filtering by a varchar field using WHERE statement?
Thanks
I was wondering if Apple allowed you to access the MPMediaItem's raw data as an NSData object. If you can, thats great and I would like to know how. If you cannot, then Apple is way too over-protective, and my app that i started is utterly useless. Also if you cannot, Is there any hacky workarounds? I don't care if Apple doesn't accept my app as it would still be cool if me and my friends all had it.
Thanks,
Conrad
Hi everyone,
In my application, I get a memory warning of level 1 and then 2 after repeating some action (choosing a picture + processing) several times and then a crash.
The leak tool doesn't show any leak. I'm also following the Allocations tool in Instruments and my Live Bytes are roughly 4 MB, overall I allocate 113 MB. At maximum I have maybe 20 MB in memory when the picture is loaded.
Since I have to repeat an action to get to the crash, it is very likely to be a memory leak. However, I don't know how to locate it since my live bytes are 4 MB and things supposed to be allocated (apart a small leak of ~100 KB in the UIImagePickerController).
How much can I trust the memory leak/allocation tools? Would you have an advice to help me locate the reason of the problem?
I'm trying to add a UIButton to a UIView, but am having some trouble with getting it to respond to touches.
I have a method which returns UIButtons after I provide it with a tag:
- (UIButton*)niceSizeButtonWithTag:(int)tag {
UIButton * aButton = [UIButton buttonWithType:UIButtonTypeCustom];
[aButton setTag:tag];
[aButton addTarget:self action:@selector(buttonWasTapped:) forControlEvents:UIControlEventTouchUpInside];
CGRect newFrame = aButton.frame;
newFrame.size.width = 44;
newFrame.size.height = 44;
[aButton setFrame:newFrame];
return aButton;
}
As you can see I'm creating a new button and increasing the size.
I use this in the following way:
UIButton * anotherButton = [self niceSizeButtonWithTag:1];
[anotherButton setImage:[UIImage imageNamed:@"image" withExtension:@"png"] forState:UIControlStateNormal];
[anotherButton setCenter:CGPointMake(middleOfView)];
[aView addSubview:anotherButton];
I create a lot of buttons like this, hence the reason for the method.
The buttons are always created and added to the subview perfectly. I can see the image and they're in the correct position. The problem is that they only respond to touches in a tiny strip.
In this attached image,
The yellow shows the whole frame of the button,
The red shows the area that will respond to touches.
The grey shows a section of the view the button is added to.
If anyone could shed some light on why this is happening, it would be really useful.
ive set the shouldAutorotateToInterfaceOrientation to return to YES for orientation then i noticed as the iphone rotates the background rotates as well which is a UIImageView. how do i have the background fixed so it doesnt rotate?
Hi,
I am writing a game in cocos2d. In the iPad Simulator the application is running good.
While I am running the application in the iPad.
But it was crashing by giving the following message in terminal. I am using 2048x2048 CCSpriteSheets in my code.
I used instruments tool there is sudden increase in memory to 32MB before crashing. It is crashing at CCSpriteFrameCache .
Program loaded.
target remote-mobile /tmp/.XcodeGDBRemote-6258-64
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
continue
The program is not being run.
The program is not being run.
Thank you.
i'd like to change sounds when tapping on an image and drag another image over several others.
it is not working properly: the "MoveImage" is not dragable, the tapping is working outside the "TouchImage" and the sounds do not change when tapping on it.
(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
if(((CGRectContainsPoint(myTouchImage.frame, location)), (CGRectIntersectsRect(myMoveImage.frame,myImage_1.frame)))) {
[sound_E play];
}
if (((CGRectContainsPoint(myTouchImage.frame, location)), (CGRectIntersectsRect(myMoveImage.frame,myImage_2.frame)))) {
[sound_F play];
}
if (((CGRectContainsPoint(myTouchImage.frame, location)), (CGRectIntersectsRect(myMoveImage.frame,myImage_3.frame)))) {
[sound_D play];
}
if (((CGRectContainsPoint(myTouchImage.frame, location)), (CGRectIntersectsRect(myMoveImage.frame,myImage_4.frame)))) {
[sound_Dis play];
}
}
(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
if (CGRectContainsPoint(myMoveImage.frame, location)){
CGPoint yLocation = CGPointMake(myMoveImage.center.x,location.y);
myMoveImage.center = yLocation;
}
if(CGRectIntersectsRect(myMoveImage.frame,myImage_1.frame)) {
E_NOTE.text = @"E";
}
if(CGRectIntersectsRect(myMoveImage.frame,myImage_2.frame)) {
F_NOTE.text = @"F";
}
if(CGRectIntersectsRect(myMoveImage.frame,myImage_3.frame)) {
D_NOTE.text = @"D";
}
if(CGRectIntersectsRect(myMoveImage.frame,myImage_4.frame)) {
Dis_NOTE.text = @"D#";
}
}
So we have buttons linked up to display images/videos/audio on click depending on a check we do earlier. That part works fine. It knows which one to play, however, when we click the buttons for video and audio, nothing happens. The image one works fine.
The video and audio are being taken for a URL online, they are not local, but everywhere said this was still possible. Here is a little snippet of the code where we play the two files:
if ( [fName hasSuffix:@".png"])
{
NSLog(@"PICTURE");
NSURL *url = [NSURL URLWithString:
fName];
UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];
self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
// self.view.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"MainBG.jpg"]];
[self.view addSubview:[[UIImageView alloc] initWithImage:image]];
}
if ( [fName hasSuffix:@".mp4"])
{
NSLog(@"VIDEO");
//NSString *path = [[NSBundle mainBundle] pathForResource:fName ofType:@"mp4"];
//NSLog(path);
NSURL *url = [NSURL fileURLWithPath:fName];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];
[player play];
}
if ( [fName hasSuffix:@".mp3"])
{
NSLog(@"AUDIO");
NSURL *url = [NSURL fileURLWithPath:fName];
NSData *soundData = [NSData dataWithContentsOfURL:url];
AVAudioPlayer *avPlayer = [[AVAudioPlayer alloc] initWithData:soundData error: nil];
[avPlayer play];
}
See anything wrong? By the way it compiles and runs, but nothing happens when we hit the button that executes that code.
I have an seen how NSXMLDocument can parse and html document, and provide easy methods for returning parts of the html structure.
Is there a similar method that can be used for the iPhone, as NSXMLDocument is not available?
Hi,
I ma writing an application where I have to parse multiple xml files as a response from a server. Till now, I have written different xml parser classes for each xml depepending on the tags present in different xmls ? Can I combine all xml parser classes and write a single xml parser that handles all different tags in different xmls ? Will it work ? Will combining xml parser classes add an overhead because xml parser will check for every tag irrespective of whether that is part of file or not ?
Please help.
Hey
is there any way to send whats in a text view (im trying to make a suggestion box) to my email address?
example
user types in the box " I think you should add twitter support"
then that is sent in the background to my email address [email protected]
then a message is popped up on the screen saying "suggestion sent"
just an example of what i mean
Any ideas, tutorial links would be greatly appreciated guys
Thanks
I have this formatted string that I am having a translator work on.
ENGLISH
"Check out the %1$@ %2$@ in %3$@: %4$@" = "Check out the %1$@ %2$@ in %3$@: %4$@"
GERMAN TRANSLATION
"Check out the %1$@ %2$@ in %3$@: %4$@" = "Hör Dir mal %2$@ in %3$@ an: %4$@";
These are passed to a [NSString stringWithFormat:] call:
//////////////////////////////////////
// Share Over Twitter
NSString *frmt = NSLocalizedString(@"Check out the %1$@ %2$@ in %3$@: %4$@", @"The default tweet for sharing sounds. Use %1$@ for where the sound type (Sound, mix, playlist) will be, %2$@ for where the audio name will be, %3$@ for the app name, and %3$@ for where the sound link will be.");
NSString *urlString = [NSString stringWithFormat:@"sounds/%@", SoundSoundID(audio)];
NSString *url = ([audio audioType] == UAAudioTypeSound ? UrlFor(urlString) : APP_SHORTLINK);
NSString *msg = [NSString stringWithFormat:
frmt,
[[Audio titleForAudioType:[audio audioType]] lowercaseString],
[NSString stringWithFormat:@"\"%@\"", AudioName(audio)],
APP_NAME,
url];
NSString *applink = [NSString stringWithFormat:@" %@", APP_SHORTLINK];
if (msg.length <= (140 - applink.length)) {
msg = [msg stringByAppendingString:applink];
}
returnString = msg;
With the desired and actual outcome of:
ENGLISH
desired: "Check out the sound "This Sound Name" in My App Name: link_to_sound link_to_app"
actual: "Check out the sound "This Sound Name" in My App Name: link_to_sound link_to_app"
GERMAN
desired: "Hör Dir mal "This Sound Name" in My App Name an: link_to_sound link_to_app"
actual: "Hör Dir mal sound in "This Sound Name" an: My App Name link_to_app"
THE PROBLEM
The problem is that I was under the assumption that by using numbered variable in the NSLocalizedString, I could do things like this, where the %1$@ variable is completely omitted. If you notice, the German translation of the format string does not use the first argument (%1$@) at all but it ("sound") still appears in the output string.
What am I doing wrong?
I want to use AVAudioPlayer to play M4p files from iTunes generator. I could use uiWebView to play it and it worked, but I want to put an image of my choice on the background of the player instead of the "quick time" logo. Can you help me as how to do this?
Here is an example of the m4p file I want to play with AVAudioPlayer.
http://a801.phobos.apple.com/us/r1000/059/Music/b9/0d/be/mzi.zqnndbil.aac.p.m4p
Seriously, big thanks in advance!!
I am trying to create a new folder in Drive and upload one (or more) files to that created folder. I use the code below, but the result is that both the folder and the file are placed in the root of my Drive.
$client->setAccessToken($_SESSION['accessToken']);
//create folder
$folder_mime = "application/vnd.google-apps.folder";
$folder_name = 'New Folder';
$service = new Google_DriveService($client);
$folder = new Google_DriveFile();
$folder->setTitle($folder_name);
$folder->setMimeType($folder_mime);
$service->files->insert($folder);
//upload file
$file_name = $_FILES["uploadFile"]["name"];
$file_mime = $_FILES["uploadFile"]["type"];
$file_path = $_FILES["uploadFile"]["tmp_name"];
$service = new Google_DriveService($client);
$file = new Google_DriveFile();
$file->setParents(array($folder_name));
$file->setTitle($file_name);
$file->setDescription('This is a '.$file_mime.' document');
$file->setMimeType($file_mime);
$service->files->insert(
$file,
array(
'data' => file_get_contents($file_path)
)
);
I've added a navigation bar to a UIViewController. It is displayed from another UIViewController only. I'd like to have a left side back button that is shaped similar to an arrow, just like the normal navigation bar back button. It seems I can only add a bar button through IB. I'm guessing the back button needs to be added programmatically. Any suggestions on how I should do this?
I am trying to form ribbon XML with the data from the database and following is what I wrote:-
XNamespace xNameSpace = "http://schemas.microsoft.com/office/2006/01/customui";
XDocument document = new XDocument();
document.Add( new XElement (xNameSpace+"customUI"
, new XElement("ribbon"
, new XElement("tabs"))));
// more code to add the groups and the controls with-in the groups
.......
// code below to add ribbon XML to the document and to add the relationship
RibbonExtensibilityPart ribbonExtensibilityPart = myDoc.AddNewPart<RibbonExtensibilityPart>();
ribbonExtensibilityPart.CustomUI = new DocumentFormat.OpenXml.Office.CustomUI.CustomUI(ribbonXml.ToString());
myDoc.CreateRelationshipToPart(ribbonExtensibilityPart);
I don't see any error executing the above. However, when I open the changed document, I dont see my ribbon added. I see following in the CustomUI/CustomUI.xml inside the word:-
<?xml version="1.0" encoding="utf-8"?><customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">
<ribbon xmlns="">
<tabs>
.....
I am not sure how the "xmlns" attribute is getting added to the ribbon element. When I remove that attribute, the ribbon gets showed.
Could anybody throw any idea on where am I going wrong?
Consider a class with these methods:
- (id) initWithFrame: (CGRect) frame
{
if (!(self = [super init]))
return nil;
webView = [[UIWebView alloc] initWithFrame:frame];
[webView setDelegate:self];
lock = [[NSConditionLock alloc] initWithCondition:LOCK_WAIT];
return self;
}
- (void) setHTML: (NSString *) html
{
[lock lockWhenCondition:LOCK_WAIT];
[webView loadHTMLString:html baseURL:nil];
[lock unlock];
}
- (void)webViewDidFinishLoad:(UIWebView *)aWebView
{
[lock lockWhenCondition:LOCK_WAIT];
// Locking to be able to unlock and change the condition.
[lock unlockWithCondition:LOCK_GO];
}
- (NSString *) stringByEvaluatingJavaScriptFromString: (NSString *) jsCommand
{
[lock lockWhenCondition:LOCK_GO];
return [webView stringByEvaluatingJavaScriptFromString:jsCommand];
[lock unlock];
}
Let's call this class SynchronousUIWebView.
From the main thread I execute:
webView = [[SynchronousUIWebView alloc] initWithFrame:frame];
[webView setHTML:html];
[webView stringByEvaluatingJavaScriptFromString:jsCommand];
The problem seems to be that the delegate is not called until I leave the current call stack, which I don't since I'm waiting for the delegate call to happen, aka deadlock. To me it seems like the delegate call is pushed to a queue that is called when the current call is done. So the question is can I modify this behavior?
Note: The reason this is needed is that I can't execute the JavaScript until the HTML has loaded.
I have an application that has lessons on British accent. This is for people who already know how to read and speak English. Is there a need to internationalize this app?
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
if (dirString)
{
CATransition *animation = [self getAnimation:dirString];
[[self superview] exchangeSubviewAtIndex:0 withSubviewAtIndex:1];
[[[self superview] layer] addAnimation:animation forKey:kAnimationKey];
}
}
Hello all Im trying to work with the code above it may look familiar its from the Iphone Developer Cookbook, Erica Sandun
what im trying to implement are 5 different views using her swipe method
the code above has a transition between 2 views only, how would i change the code so i can swipe through all five views, example: view starts on view 1 then user swipes right then changes to view 2 and so forth and backward
your help is much appreciated