Questions tagged [objective-c++]

94145 questions
1

votes
3

answer
1.5k

Views

Need to enable UITextField in row of UITableView when cell is selected in iOS

I have created a custom cell that places a UITextField in each row of a UITableView. What I would like to do is enable the UITextField for a particular row (i.e. activate the cursor in that textfield), when the user presses on anywhere inside the cell. I have the following method where I try to do...
syedfa
1

votes
3

answer
1.8k

Views

Animate UILabel in UITableViewCell

I have a custom UITableViewCell with three labels - title, subtitle and right detail. Now when a User taps on Cell this Cell becomes checked with the normal Checkmark, but I need to animate the right label to the left. I thought I could just do CGRect rect = cell.playerRatingLabel.frame; rect.origin...
user1396236
1

votes
1

answer
1.8k

Views

Access audio buffer of an AVAudioSession

Hope this question makes some sense, I'm completely lost.... In my proto-app I'm recording micro input and saving it, and so far no problems at all. I now need to access the buffer while I'm recording it in order to pass chunks of data to another class (written in C, not by me) that will do some ana...
Sr.Richie
1

votes
1

answer
1.9k

Views

How to update CollectionView's numberOfItemsInSection after block finishes executing

I would like to put up a UICollectionView of pictures downloaded from a backend provider, and am running the issue where every time my collection view controller is initialized, the required method - (NSInteger) collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)sect...
daspianist
1

votes
2

answer
333

Views

Call method only once every app launch

Hey guys at Stackoverflow! I need your help. I am looking for a way to call my method only once after the application has launched and "save" the state of the color of the UIView. At first I will show you my code, that I can explain it in a better way: -(void)viewWillAppear:(BOOL)animated { NSArray...
MasterRazer
1

votes
2

answer
1.5k

Views

Checking for duplicate events without getting all events in the Event Store in IOS

I am adding array of events to IOS calendar.As it has to happing on clicking a button.By doing this all the events are getting added again and again.So to over come that I used NSPredicate to get all the events and doing validation like below NSDate *edate=[formatter dateFromString:startDateString]...
iSwaroop
1

votes
1

answer
1.1k

Views

Change position of UIView doesn't work

I have a UIView and I would like to move it up by 50. I wrote the following: NSLog(@"before %@",NSStringFromCGRect(_flixSuggestionsView.frame)); _flixSuggestionsView.frame = CGRectMake(_flixSuggestionsView.frame.origin.x, _flixSuggestionsView.frame.origin.y-45, _flixSuggestionsView.frame.size.width,...
Dejell
1

votes
1

answer
7.6k

Views

UITableView Header Styling - Font Color / Background / Font Size

Im struggling trying to style a UIView Header, I'm using IOS7 storyboard and custom cells - each of which has its own class - I would to achieve an opaque grey background with white text - Helvetica Neue Medium Font size 16 - the initial header is hidden in the HeightForHeaderInSection method - So...
Dancer
1

votes
2

answer
2.6k

Views

convert hex to NSString

i converted to hex by: NSString * hexStr = [NSString stringWithFormat:@"%@", [NSData dataWithBytes:[string cStringUsingEncoding:NSUTF8StringEncoding] length:strlen([string cStringUsingEncoding:NSUTF8StringEncoding])]]; i converted from foreign language so each character is now 4 bytes in hex. i ha...
user2755038
1

votes
1

answer
5.1k

Views

UITableViewCell custom accessory button

I use this accessory in cells in a TableView: cell.accessoryType = UITableViewCellAccessoryDetailButton; I would like this detail button to look like the clear button in text fields though. How do I do that and still be able to use accessoryButtonTappedForRowWithIndexPath:indexPath method.
ZviBar
1

votes
1

answer
1.7k

Views

NSNotificationCenter not working ios 7

I'm trying all kinds of examples of NSNotificationCenter, but none of them are working. I have a UITableViewController that when a user clicks a cell, it opens a UIViewController that houses a WebView. Just to get the ball rolling, I'm trying to have the UITableViewController log a message that it...
A2345sooted
1

votes
2

answer
746

Views

Will displaying a UIAlertView in a separate thread stop processing in main thread?

I have an iPad app that makes appointments. If the user happens to overlap an existing appointment, I need to let them know via a UIAlertView. The problem is of course, that the UIAlertView doesn't get displayed until the 'Save' method completes it's processing. I was thinking of using a separate...
SpokaneDude
1

votes
2

answer
909

Views

'Attemped to add nil node', reason: 'Attemped to add nil node to parent: <SKScene> name:'(null)'

I have these 3 lines of code: self.tapToFlyLabel = [SKSpriteNode spriteNodeWithImageNamed:@"tap_to_fly"]; self.tapToFlyLabel.position = CGPointMake(self.size.width/2, self.scene.size.height-250); [self addChild:self.tapToFlyLabel]; Everything works fine while running on 'iPhone retina 3.5', 'iPhone...
almas
1

votes
2

answer
787

Views

Three Column Table embedded in UITextView

My project consists of displaying a document in a UITextView. Most of the document is pretty straight forward attributed text and I have that working just fine. There are other parts of the document that consist of normal text and then a 3 column table with 2 or 3 rows basically right in the middl...
1

votes
4

answer
1.4k

Views

How to display images on button action

I have 10 UIImages. When I click the UIButton it displaying under UIScrollView. But I need to implement theUIButtonlike **Next**, ifUIButtonis clicked first time, it displays the firstUIImage`, then after that, on click it displays next image. If I click the back button, the previous image should be...
user3351727
1

votes
4

answer
637

Views

how to set background image properly in iOS

I am working on a view based app, I have set the background image as follows. .h file: UIImageView *BackgroundImage; .m file: viewdidLoad method: BackgroundImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BG.png"]]; [[self view] addSubview:BackgroundImage]; [BackgroundImage.superview...
M Zubair Shamshad
1

votes
3

answer
2.7k

Views

UIPickerView select row doesn't work ios7

I have a UIPickerView that is being "pushed" to UINavigationController like this: [self.navigationController pushViewController:vc animated:YES]; I would like to set the selected row. I added in ViewDidAppear: for (int i = 0; i < [countryCodes count]; i++) { if ([[countryCodes objectAtIndex:i] isEqu...
Dejell
1

votes
1

answer
25

Views

iOS - expecting unreasonable character

I am getting a weird error in my Xcode compiler when doing app for iPhone. The error I get is: Expected ']' - (IBAction)backButton:(id)sender { NSUserDefaults* standardUserDefaults = [NSUserDefaults standardUserDefaults]; if(standardUserDefaults) { NSString* isNewNote = [standardUserDefaults object...
Sam
1

votes
3

answer
445

Views

Adjust the font of UILabel so that the text fits within the label's bounds

My view controller has a UILabel. It displays a dollar amount to the user. I have a default size that I like the dollar amount to be displayed as, shown below When the amount is too large, some text is replaced with "..." I want to adjust the text of the UILabel (make it smaller) such that the poi...
JuJoDi
0

votes
0

answer
4

Views

How can i convert OpenCV java code to Objective C?

I need to convert below code snippet to Objective-C Actually I want to add every index of byte array in j'th index of Mat. Below is the code that i tried so for but unfortunately i am not able to convert it. Any help or clue will be realy appriciated. Mat spectrumHsv = new Mat(1, (int) (maxH - min...
Mustanser Iqbal
1

votes
3

answer
642

Views

equality of two objects in Objective C [duplicate]

This question already has an answer here: Should you use 'isEqual' or '=='? 2 answers Comparing objects in Obj-C 4 answers I am reading the Programming with Objective-C . In the section of Determining Equality of Objects , it says the following words: - When dealing with objects, the == operator i...
Leem.fin
1

votes
1

answer
248

Views

Set the width of SIAlertView

How can I set the width of SIAlertView? I tried this for example and it only set the height not the width. SIAlertView *alert = [[SIAlertView alloc] initWithFrame:CGRectMake(20, 20, 240, 100)]; And I also tried to set it when it fires SIAlertViewWillShowNotification like below - (void)SIAlertV...
Nihat
1

votes
1

answer
602

Views

iOS NSLinguisticTagger always return null when getting the lemma stem

I need to match a keyword (which is in its lexical form) with a text and return whether the keyword matches (just like a search engine) for example text: I want some apples keyword: apple result: matched keyword: banana result: not matched This is my method, I always get null for the tag - (BOOL)mat...
OMGPOP
1

votes
2

answer
834

Views

How to grab UIAlertView from UIWindow object in iOS7

I want to make a single listener which grabs UIAlertView whenever it is shown to users. I first setup this observer. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeVisible:) name:UIWindowDidBecomeVisibleNotification object:nil]; and then get UIWindow object...
1

votes
1

answer
207

Views

CGImage causing memory leak

I am creating a cgimage using this code: UIGraphicsBeginImageContext(CGSizeMake(size*2, size*2)); CGContextRef ctx = UIGraphicsGetCurrentContext(); [[SKColor colorWithWhite:0.8 alpha:1] setFill]; CGContextFillEllipseInRect(ctx, CGRectMake(0, 0, size*2, size*2)); UIImage *textureImage = UIGraphicsGet...
maxhud
1

votes
1

answer
1.1k

Views

NSStackView only shows newest custom view

I have a custom view controller class. I want to instantiate multiple custom view controllers and add their views to my NSStackView. I add a new view to the stack view by clicking a button. The button calls this method: [stackView insertView:myCustomViewController.view atIndex:0 inGravity:NSStackVie...
user2320861
1

votes
1

answer
1.1k

Views

NSMutableArray Setter and Getter Methods

I am trying to make an FoodCourt Application. I have 3 MutableArray in AppDelegate.h // This are declaration and Getter and Setter methods for array. AppDelegate.h @property(strong,nonatomic)NSMutableArray* NameArray; @property(strong,nonatomic)NSMutableArray* QtyArray; @property(strong,nonatomic)NS...
Rajan Palaniya
1

votes
1

answer
877

Views

Layout incorrect at end of awakeFromNib - requires resize to correct it

I have an awakeFormNib function which adds some subviews. It is not using auto-layout. Normally it appears perfecty. On some machines it appears with one of the subviews too small. As soon as I resize the window (with the mouse) it all lays out perfectly. It seems that seme layout operation is happe...
user2327126
1

votes
3

answer
156

Views

Moving Content That Is Located Under the Keyboard [duplicate]

This question already has an answer here: How can I make a UITextField move up when the keyboard is present - on starting to edit? 90 answers I have a question concerning "Moving Content That Is Located Under the Keyboard". I have a simple "sign in" view with 2 UITextFields (username and password)...
Michel
1

votes
1

answer
892

Views

iOS how to add date and name metadata to file stored on disk?

Is there some way on iOS to add attributes to a file that I'm saving in the documents directory? Ideally I would have the file name, created date and duration. I'm currently using two date formatters formatters and am using the filename to store date. This will quickly prove unmanageable if I need...
Alex Stone
1

votes
1

answer
291

Views

How do I add an offset to CGContextFillEllipseInRect in CoreGraphics?

I want to add top offset to CGContextFillEllipseInRect. When I used topOffset equals to zero everything was ok. But when I used not zero offset I got wrong circle. I tried to set CGContextTranslateCTM(context, 0, topOffset); but result was the same. float topOffset = 30.f; CGContextRef context = UIG...
Voloda2
1

votes
1

answer
1.5k

Views

Setting Mac OS X volume programatically after 10.6 (Snow Leopard)

Is there a way to set the Mac's System Volume using Objective-C? I tried using: AudioDeviceSetProperty([[self class]defaultOutputDeviceID], NULL, //time stamp not needed 0, //channel 0 is master channel false, //for an output device kAudioDevicePropertyVolumeScalar, sizeof(Float32), &volume); But i...
radman
1

votes
1

answer
566

Views

Retrieving URL of a file parse.com

I'm trying to get back the url of a file I just saved. However, the getUrl() method found in their documentation doesn't seem to work. I get the error: Property 'getUrl' not found on object of type 'PFFile *' My code: int count = 0; PFObject *obj = [PFObject objectWithClassName:@"File"]; for (NS...
Wookies'n'Cookies
1

votes
2

answer
1.3k

Views

iOS Get Language of Keyboard [duplicate]

This question already has an answer here: Detecting current iPhone input language 6 answers Can we get the language of the current keyboard that user is using.. that is see wether the user is using English keyboard or Chinese Keyboard or some other language one…? I can get the language of the de...
Ahmed Z.
1

votes
2

answer
2.1k

Views

Linker command failed with exit code 1 Facebook SDK

The errors started to occur as follows after adding the Facebook SDK to my project ("FacebookSDK.framework") ld: 76 duplicate symbols for architecture x86_64 duplicate symbol _OBJC_IVAR_$_BFAppLinkTarget._URL in: /Users/sorewarding/Downloads/aws-ios-sdk-2.0.3/third-party/Bolts.framework/Bolts(BFAppL...
Yrol
1

votes
3

answer
942

Views

how to hide keyboard when i touch screen in iOS

i am creating search bar in iOS when i press search bar keyboard will be appeared but after the search complete i want keyboard will be disappeared on screen. i am implement code but its not hide . //this methos show to create dynamic search bar -(void)SearchBarCode...
Chetan Gharat
1

votes
1

answer
1.1k

Views

Using KVO to observe a property of custom class

I have 2 class, Foo and Bar, as below: @interface Foo : NSObject @property Bar *bar; @end @interface Bar: NSObject @property int intVal; @property long longVal; @end Now I want to use KVO to observe for change in property bar of an object of class Foo. But I would like to know if I change 1 of bar's...
it4rb
1

votes
2

answer
3.4k

Views

How To Compare Integer to Objective-C enum

- (void)updateCheckBoxes { NSArray *availableFuncUnits = _scanner.availableFunctionalUnitTypes; for(int i = 0; i < [availableFuncUnits count]; i++) { } } If I put a breakpoint inside the for loop, the elements of the NSArray * 'availableFuncUnits' are (__NSCFNumber *)(int)0 and (__NSCFNumber *)(long...
AyushISM
1

votes
1

answer
252

Views

How to minimze quad count in SpriteKit

I'm looking at increasing performance in a SpriteKit application. I noticed in iOS 8 that Apple has introduced a debug property called showsQuadCount to SKView. Their description on the property says that a lower number is usually better. When I enabled it, I'm horrified to find out that the quad co...
jervine10
1

votes
1

answer
402

Views

Programmatically change position of UIImage

I tried to create a simple animation on an UIImage that has to start from the position X = 0 and has to end at the position X = device width I tried to use the following code inside the viewDidLoad method: CGRect screenBound = [[UIScreen mainScreen] bounds]; CGSize screenSize = screenBound.size; CGF...
aisfdjjif

View additional questions