Search results for

column

2,046 results found

Post

Replies

Boosts

Views

Activity

Tabbing between cells in view-based table views
Hello,In cell-based table views (NSTableView and NSOutlineView), if you had editable text field cells, tabbing out of a text cell would automatically move the focus to the next editable cell. So, say you had a table composed of five rows and three columns. If you were editing row 4, column 2 and hit tab, the cell at row 4, column 3 would gain the focus (presuming it was editable; otherwise the next editable cell would get the focus). If you hit tab again, row 5, column 1 would get the focus. And if the cell at row 5, column 3 was being edited and you hit tab, focus would cycle up to row 1, column 1.In view-based tables, however, this does not work as expected. In view-based tables, things work as follows:1. You double-click to start editing a cell - e.g. row 4, column 2.2. You hit tab and things work as expected to begin with.3. However, when you reach the last cell in the table and hit tab again, focus returns to the table view and editing ends.4
Topic: UI Frameworks SubTopic: AppKit Tags:
6
0
2.8k
Sep ’15
Reply to Can I rename an app existing and then submit a new app with the name of the original?
You probably want to do this:Change the display name of your existing app (see the note)Create your second app with the old display name (adding the info.plist)You cannot change the bundle id but there is no need to do so, just update the display nameTechnical Q&A QA1823Updating the Display Name of Your AppQ: How do I change the name displayed underneath my app icon on my device's Home screen?A: To change the name appearing underneath your app icon, modify the CFBundleDisplayName key in your Info.plist. Follow these steps to modify CFBundleDisplayName:In Xcode, click the disclosure triangle next to your app folder in the project navigator to reveal its content as shown in Figure 1.Click the disclosure triangle next to the Supporting Files subfolder to reveal its content.Select the Info.plist file to reveal a property list editor of keys and values.By default, Xcode displays a human-readable string of a key rather than its actual name. So, search the property list for Bundle display name. Skip to step 5 if
Sep ’15
NSFetchedResultsController SUBQUERY no such column
I am having issues with subqueries in the predicate for the fetch request of an NSFetchResultsController. Basically the object I'm fetching on has a to-One relationship that has a to-Many relationship that I am performing the subquery on, so it looks like this Target <<--> Person <<-->> ExtendedProperty. I am fetching all targets that have a specific name/value in the extendedProperty of the target's person.Here is what my predicate looks likerequest.predicate = NSPredicate(format: SUBQUERY(person.extendedProperties, $extProp, $extProp.name == %@ && $extProp.value == %@).@count > 0, favorite color, red)When I try to use this I don't get any results and the console outputs2015-09-08 17:33:26.206 CoreDataBug[2019:313174] CoreData: error: (1) I/O error for database at /var/mobile/Containers/Data/Application/EAFFE09B-D259-4917-A13F-2D46D0D81816/Documents/CoreDataBug.sqlite. SQLite error code:1, 'no such column: t2.ZNAME'I'm trying to figure out if I'm doing something wrong
4
0
878
Sep ’15
loop through array items into collection view
Hi everyoneI would like to know is there anyway that we can loop through an array of items using indexPath and pass it to the collection View.As collection view has section and row as IndexPath,is there any way to loop through a single dimension array?Cause this can be done simply with table view, so I hope there is a solution to this.Edit:Just say for an example I have an array of 20 strings. If I want to loop through each of the string to be label for the table view, I use the function cellForItemAtIndexPath and I will use the indexPath.row to loop through each item eg(string[indexPath.row]). This can be done like this for tableView. However, collections seems a bit more complicated as when I use the cellForItemAtIndexPath, it doesnt return only row column as indexPath, but also the section column. So I will not be able to just loop though using eg.(string[indexPath.row]). I was wondering is there any easier method to overcome this?Thank you
4
0
4.5k
Sep ’15
CLKComplicationTemplateModularLargeColumns Column 2 Alignment Issues GM
With the GM version came the ability to change the column 2 text alignement. In the prior beta version, the text for the CLKComplicationTemplateModularLargeColumns template was showing up as expected from the Apple documentation: https://developer.apple.com/library/prerelease/watchos/documentation/ClockKit/Reference/CLKComplicationTemplateModularLargeColumns_class/index.html#//apple_ref/occ/instp/CLKComplicationTemplateModularLargeColumns/column2AlignmentBasic assumptions lead me to test the CLKComplicationColumnAlignmentLeft first of course to match the previous behavior. However, this yielded some unwanted results. The column2 text was now right aligned. I then tested both CLKComplicationColumnAlignmentRight (which aligned it slightly more to the right and off the screen) and having no text alignment specified (column 2 now covered column1). The below code shows a test left aligned template: CLKComplicationTemplateModularLargeColumns *targetTemplate = [[CLKComplicationTemplateModularLargeC
2
0
475
Sep ’15
How to add a device id to a profile? The refresh profiles button has gone from Xcode 7
In the olden days when I added a new device id to the provisioning portal I could then go and edit the relvant profiles to include it and then download the profile or pull it down from within Xcode.However now it is no longer possible to directly edit any profiles from within the portal, instead things are managed from within Xcode.However in Xcode 7 (and 7.1 beta) the little circular button to refresh the profiles has gone, when viewing the list of profiles the actions column in blank, and the download all profiles button doesn't do anything if the profiles are already downloaded.So the question is, if a new device id gets added to the provisioning portal, how do you get it inside a profile and that updated profile installed on the Mac/ XCode?
11
0
4.9k
Sep ’15
Make method less repetative
I have the below function which generates and returns a new function. I'll call the returned function repetatively, and thus wanted to make it become its own function, vs this one just always checking numberOfPlayers first and then doing the next check. As you can see, the returned function is somewhat repetative. For example, I always have to set newCol to -2 * column, I already return the same thing for cases 0 and default, And the tuple returned always has the value of newCol as the column parameter. Is there any way to shorten the code in this function, other than the obvious choice of breaking the internals into three separate methods?The way it's written now works exactly as expected, it just feels like a code smell when I look at it. private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) { if numberOfPlayers == 8 { return { row, column in let newCol = -2 * column switch column
23
0
1.5k
Sep ’15
Reply to Make method less repetative
Again, I may be reading your code incorrect but something like:private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) {return { row, column inlet newCol = -2 * columnswitch numberOfPlayers {case 8:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, row ^ 1)}case 16:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, 3 - row)case 2:return (newCol, row ^ 1)}case 32:switch column {case 0:return (newCol, row / 2)case 1:return (newCol, (row + 4) % 8)case 2:return (newCol, row)case 3:return (newCol, row ^ 1)}default:return (newCol,0)}}It's not a big change, 35 lines instead of 50 but if I'm reading it right, it should do the same thing your existing versiondoes.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to Make method less repetative
Although not understand the purpose of your code (which makes it difficult to propose any improvement), try this:private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) { switch numberOfPlayers { case 8,16,32: return { row, column in let newCol = -2 * column switch column { case 0: return (newCol, row / 2) case 1 where numberOfPlayers == 8: return (newCol, row ^ 1) case 1 where numberOfPlayers == 16: return (newCol, 3 - row) case 1 where numberOfPlayers == 32: return (newCol, (row + 4) % 8) case 2 where numberOfPlayers == 16: return (newCol, row ^ 1) case 2 where numberOfPlayers == 32: return (newCol, row) case 3 where numberOfPlayers == 32: return (newCol, row ^ 1) default: return (newCol, 0) } } default:abort() } }You also can combo some cases like this:case 1,2 where numberOfPlayers < 32: return (newCol, row ^ 1)But only you can tell whats make sense for your code.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to Make method less repetative
I'm sorry, maybe I'm being totally dense, but what Wallace wrote would be no different than if I had just done this and not returned a new function:func theMethodToCallOverAndOver(column: Int, row: Int) -> (column: Int, row: Int) { let newCol = -2 * column switch column { case 0: return (newCol, row / 2) case 1 where numberOfPlayers == 8: return (newCol, row ^ 1) case 1 where numberOfPlayers == 16: return (newCol, 3 - row) case 1 where numberOfPlayers == 32: return (newCol, (row + 4) % 8) case 2 where numberOfPlayers == 16: return (newCol, row ^ 1) case 2 where numberOfPlayers == 32: return (newCol, row) case 3: return (newCol, row ^ 1) default: return (newCol, 0) } }That means every time I call the method, I'm checking the value of numberOfPlayers.
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to Make method less repetative
This is the best I can come up with:private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) { let closure : (column: Int, row: Int) -> (Int) if numberOfPlayers == 8 { closure = { row, column in switch column { case 0: return row / 2 case 1: return row ^ 1 default: return 0 } } } else if numberOfPlayers == 16 { closure = { row, column in switch column { case 0: return row / 2 case 1: return 3 - row case 2: return row ^ 1 default: return 0 } } } else if numberOfPlayers == 32 { closure = { row, column in switch column { case 0: return row / 2 case 1: return (row + 4) % 8 case 2: return row case 3: return row ^ 1 default: return 0 } } } else { abort() } return { row, column in let newCol = -2 * column return (newCol, closure(column: row, row: column)) } }
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to Make method less repetative
Oh, ok. I had misunderstood what you are trying to accomplish.FWIW, besides the fact there is not what you want, maybe i should have written in this way...private func generateLoserLocationFunction(numberOfPlayers: Int) -> (column: Int, row: Int) -> (column: Int, row: Int) { switch numberOfPlayers { case 8,16,32: return { row, column in let newCol = -2 * column switch (column,numberOfPlayers) { case (0,_): return (newCol, row / 2) case (1,8), (2,16), (3,32): return (newCol, row ^ 1) case (1,16): return (newCol, 3 - row) case (1,32): return (newCol, (row + 4) % 8) case (2,32): return (newCol, row) default: return (newCol, 0) } } default:abort() } }But going back to you problem, so, if i understand well, it's a case of premature optimization, like in our example of colors:func generateGetColorFunction(numberOfPlayers: Int) -> () -> UIColor { if numberOfPlayers == 8 { return { return UIColor.redColor() } } else if numberOfPlayers == 16 { return { return UI
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to Make method less repetative
Not only does this seem like premature optimization, but I suspect that it's actively counterproductive.When you structure the code using a function-returning function, you're preventing the compiler from doing any inlining. The compiler can't assume that theMethodToUse points anywhere in particular, because its value is calculated at run-time. So any reference to theMethodToUse() will probably result in an actual function call. I suspect you'd be better off from a performance standpoint doing an inlined switch on the number of players, even if that value is constant.But you really can't say for sure without doing some testing. And regardless of the answer, this code is highly unlikely to ever be a performance bottleneck. You just shouldn't be worrying about performance in this context until you've been able to prove that it's an issue in the environment of the completed application.As far as brevity, I don't think you can do much better than Wallacy's revised version with the tuple-valued switch. But that co
Topic: Programming Languages SubTopic: Swift Tags:
Sep ’15
Reply to accessibility UIPicker
After viewing the video sessions from 2012 to 2015 from WWDC, I was able to figure out how to set up a table cell and and group text labels into one phrase.However, I am disappointed in the current support provided for the UIPicker. This just isn't acceptable. The accessibility API needs to be expanded for elementsthat take input so that the user has a better experience. Specifically, it would be nice to have an API that summarizes the UIPicker and helps to describe how many columns have been placed side by side. If multiple columns are being used (ie, a date picker), it would also be nice if the user received the changing values periodically and cohesively across the columns.I am also very disappointed with the accessibility API for the UITextField. More API is needed to guide the user to understand the usage of things like customized keyboards and scrolling to edit multiple textfields. When a textfield is used in an alertViewController, the voice over message is incoherent as it bounces fr
Topic: App & System Services SubTopic: Core OS Tags:
Sep ’15