objective c - How to prevent the user from choosing some file types? -
i want prevent user choose file types when opens nsopenpanel. can @ moment preventing him accessing files , allow want allow files except some. nsopenpanel*openpane = [nsopenpanl openpanel]; [openpanel setallowfiletypes(nsarray*)]; but want user choose files except files not choose files out of files. implement delegate panel. nsopenpanel inherits delegate property superclass nssavepanel . in delegate, implement either: - (bool) panel:(id)sender shouldenableurl:(nsurl*)url; or: - (bool) panel:(id)sender validateurl:(nsurl*)url error:(nserror**)outerror; you should use first 1 if can decide whether given url should enabled , efficiently. called frequently. controls whether or not given url selectable in panel. you should use second 1 if decision slow or requires significant cpu or i/o. called when user clicks open button. that's not best user experience. it's better prevent user making bad choice let them make bad choice , reject @ last moment. a...